Door Physics
door simulations with avatar motion capture
door simulations with avatar motion capture
Avatar motion capture synced with door physics simulations is now supported in APS.
There are two ready-made door example maps you can use to create motion capture and export and use the animation with custom Blends and other scenes.
Using the Unity's Joint System and the APS_SDK Sandbox to deliver amazing realistic simulation with unlimited flexibility and simplicity.
You can quickly adapt the existing templates to your own projects, all door simulations are exported as a animated "empty" to Blender (and even includes SFM .dmx) you can use as a placeholder that is synced with the avatars mocap in the scene. Simply attach any custom door model to the animated empty and render!
This three part tutorial shows a very simple example walkthrough. Initially explains how to record mocap using VR and create the mocap of the officer kicking open the door and then walking into the room. Then the second part explains the export process and importing the scene into Blender. The last goes into detail about connecting the door model to the exported door rig (animated empty) and final rendering:
VR motion capture of officer kicking door open
Export simulation scene to Blender
Connect door rig Animated Empty to door model
All of the above tutorials were created very quickly and many steps were missed. One important note is how the feet did not react to the door when the avatar kicked it open, so there was infinite force imparted. That was because the default ragdoll collisions were enabled. However this tutorial later includes a section explaining how to enable Feet Physics so that the avatar's feet would appear to react or deflect slightly when colliding with the door, so the door's mass is taken into account during the simulation, and provides additional parameters that can be adjusted in-game to change the behavior of the effect. For kicking physics enable Feet Physics, but also for pushing you can enable Hands Physics option that works exactly the same! More mention about this in the Touch Collisions section below.
All of the assets for this tutorial are already included with the game so you can follow along and easily create a similar final rendered animation. You can even adapt the exported results to your own custom Blends to create entirely new environments without needing to build any custom assets for the game, simply use the provided example scenes as templates to create and export the mocap, then when importing in Blender a new animated empty is created that includes the door animation. You can use this empty as the pivot point animation for any custom door/panel and create scenes using almost any door model!
There are two Door Example worlds included in the game, both are scenes are also included in the APS_SDK and are fully playable maps that include the Joint System setup and doors with colliders and the custom Sandbox components needed to build the custom scene. However building a custom scene is not necessary, to understand in more detail why a custom scene would be preferred is another subject but mostly depends on the artist's needs. As a example if all you needed was to create a animation of kicking a door open you could totally use the already included example scenes to generate the animations then adapt them to almost any scene, but if the goal is to create a animation where the avatar walks through multiple doors where each door is arbitrarily located, then building a custom scene, or using the examples and copying the example doors to the new locations would be necessary.
There are two workflows when recording doors in APS. the general workflow is to simply use the existing door maps provided with APS to record the simulation, then export the mocap to Blender and rig the animated empty to a existing door model by moving the custom scene to align with the example door then simply set the parent of the new door to the animated empty. The second more advance workflow is to build a custom scene that includes doors which allows more flexibility and the ability to add any number of doors located anywhere in the scene (more on the advanced workflow later).
For most users it should be adequate to simply use the existing door examples to generate the animation and replace the exported door models with custom door models.
Both examples can be found in the APS_SDK, the blends are included with the game. You can build on these scene examples to get started quickly!
If the existing door scenes are not what's needed you can setup a custom door using the APS_SDK. There are already two fully setup demo scenes included in the APS_SDK you can use as templates. If you'd like to modify the behavior of the existing doors to create entirely new simulations. You can also find the .blends for both maps so you have the ready-to-render scenes, of course you can edit the scene to create a new atmosphere, but keep the door alignment then it's really simple to export mocap and apply it to your custom Blender scenes.
When recording avatar mocap starts the doors also record animation keyframes, when playing the recorded scene back you should see the avatar and door animations are synced.
Kick Doors - Almost all doors are kick doors, where colliders have been added to the door that allow the avatar to contact the door and allows kicking/pushing doors open or closed.
The Debugging Widget allows disabling body collisions so only the door handle can be used, to prevent accidentally bumbling the door open.
Door Handles - Grabbable colliders attached to the door's joint system allows the avatar's hands to attach to the door handle, then blends back to the controller target after being ungrabbed. The door can be pushed or pulled directly from the handle. The avatars hands will rigidly attach to the handle while grabbed and give the appearance of realism.
Door hDoor handles can be used with ragdoll or hand physics , when hand physics is enabled the doors mass is used in the simulation and would produce the illusion of a heavy vault door.
There are two collision modes that allow the avatar to interact with doors.
Ragdoll Collisions - This mode is enabled by default . The avatar simply pushes the door with infinite force and the door will react to any body collider.
Physics Collisions - When you enable the Hand Physics or Feet Physics toggles the avatar will react to the door's mass, eg. knock without instantly pushing the door open.
As mentioned in the first tutorial above "a important note is how the feet did not react to the door when the SWAT avatar kicked it open", this is because only the default ragdoll collisions were used. If you wish to add reaction force to the feet or hands you can enable the Hand Physics or Feet Physics options in the avatar profile menu.
Check out the Heavy Doors Video and notice how the hands physics collisions are enabled so doors with mass gives the appearance of being difficult to open.
Touch Collisions - From the avatar profile menu navigate to Hands Physics section and click on the small Touch icon located on the title bar.
Visible Colliders - Show the overlapping touch colliders on the avatar's hands. Allows you to adjust colliders so the avatar fingers appears to touch the door without clipping.
When collisions have been enabled for either the hands or the feet then the ragdoll colliders are ignored and only the physics colliders are used. The avatar's hands will not be able to penetrate solid objects, however objects with mass (eg. doors) will react to the hand or feet physics colliders using the mass and force of the collision. This can be used to create animations realistic collisions with objects.
By default the hand and feet colliders are calibrated to average human strength so the results look realistic, punching a door will cause the hand to slow slightly on impact as the door starts moving (unlike the infinitely strong ragdoll mode).
Using physics colliders you can adjust the strength of the avatar to achieve superhuman force.
Punch Force - From the Hands Physics menu in the avatar profile you can adjust the Punch Force slider to control the amount of force imparted into objects when they're punched (also see Kick Force). When punching doors you can multiply the impacts to create superhero punch effects.
This video demonstrates recording motion capture in VR of a avatar punching a door that has a Break Force set. Increasing the Punch Force slider gives the appearance of super human strength.
The motion capture from the above video was exported and rendered as a benchmark using Blender Cycles to see the effect at full 60fps. The animation should be more clear than in the VR tutorial.
I added a slight camera shake effect in post but the animation was not edited, this is motion capture exported directly from APS.
Download the Break Door example scene on Steam Workshop.
Read more about breakable hinge joints.
Helper UI overlays that are placed over the Sandbox components around the scene, such as doors and allows adjusting in-game parameters and changing the behavior of the door, or for locking the recorded door animations when creating multi-avatar scenes. There is more discussion about the use of the scene widgets in the Heavy Doors example video!
Door Widget - The door example scenes contain widgets that allow adjusting the physics sandbox parameters and will be shown on any SandboxEmpty that had `isRecordable` set true in the inspector when building the scene.
You can adjust the door parameters in VR to create new door behaviours (eg. bank vault doors) simply by tweaking the values in the widget.
Recordable - Sync with mocap recording start, or lock previous recording.
Collide Ragdoll - Door collides with avatar's body colliders.
Mass - Weight of door (typically 10 - 25).
Drag - Rate door stops moving, deceleration.
Recordable Toggle - When recording starts all previous door animations in the scene are cleared and new animation data begins recording. This will erase the previous door animation so when creating multi-avatar scenes if you don't want a door's previous animation data to be modified you can lock the recording using the door Debugging Widget to set the Recording switch to off.
Storyboard Debugging - This switch is located in the VR menu under Settings>Display. Enable this to display the debugging widgets in the scene. When this switch is enabled the debugging menus will appear on all physics Sandbox components in the scene to allow you to adjust paraments.
Note debugging widgets are hidden during mocap recording and playback. Check out the Heavy Doors tutorial video that shows how to use the door debug Widget !!
Adding mass to doors gives the appearance of being difficult to budge, stone or even a bank vault doors can be simulated. In the Tomb example the mass of the rigidbody has been turned up significantly (eg. mass 500) and the drag set to 10 or higher so the door stops immediately after being pushed. For bank vault doors however the drag should be left at zero to simulate low friction bearings.
Tutorial video of a archeologist in a ancient tomb opens a large stone door.
This is a video I created just for fun to show the workflow.
You can download the tomb door example scene from the Workshop and even includes the textured .blend for final rendering :)
Knock Knock Doors - Check out the Door Knock example scene included in the APS_SDK that shows the concept of using a simple collider panel placed in-front of the door that allow a surface for the avatar to knock against without bumping the door open.
There is a playable scene you can find on the Steam Workshop. For the knock collisions to work properly you must enable Hand Physics (aka Touch Collisions). The reminder graphic in the scene simply says:
After exporting mocap a new folder is generated that contains all of the motion capture files. These include files that can be used directly with Blender, SFM or Unity.
If you'd like to add custom scenes that include door simulations using the APS_SDK this section will explain some of the basic components that can be found in the APS_SDK Sandbox folder. Building custom maps offers a high degree of flexibility over using the existing maps. You can create scenes with custom door simulations, multiple doors, heavy doors, boulders or other door-like objects, panels and window, etc.
Below is a walkthrough of the example scenes and how they utilize the APS_SDK Sandbox components.
These are scripts you can use to build interactive scenes and props. In this tutorial I am going to go over only a few of the components available but you should look at all of the examples available in the SDK
You can find a collection of ready-made door example scenes in the APS_SDK. With the SDK imported into a Unity project look for the DoorExample scenes folder:
Records gameobject mocap, exports as animated empty.
The isRecordable checkbox should be enabled.
Sandbox Empty - Exports mocap of the connected gameobject as .bvh and a animated empty prop to Blender (.dmx and .anim files are also generated).
SandboxEmpty components should be added to the gameobjects aligned with the door pivot and have Export Rotation enabled, this will record the hinge rotation.
The door hinge transform
Break Force - Doors (aka. hinge joints) typically have the break force set to "Infinity", however it is possible to specify a lower break force so the door will separate from the hinge when the force is exceeded.
Note how the SandboxEmpty from the Break Door example scene has "Export Location" enabled, this is so the door's location is also recorded!
The SDK example: Door Example (Breakable)
Break Door playable scene on Steam Workshop
Makes the trigger collider grabbable, connects the avatar's hands to the door joint system.
Collider Grab Handle - The ColliderGrabHandle is optional but should be added to a trigger collider that is part of the door joint system.
Not all doors require this object, only if you wish to add a grabbable handle to the door.
The handle 'trigger' collider
A collection of all of the rendered animations:
Thanks for reading ❤️