With AdaptGround Behavior
Sometimes it can be useful to take other Entities into account when adapting to the ground. Especially in battle simulations where there're dead entities lying on the field. This can be achieved using the Adapt Ground Behavior.
Setup
In this scene, let's create two Entity Types, one for the walking Entities and one for the dead Entities and populate them using two separate Population Tools:
Physicalize the Dead Entities
To be able to be taken into account in the ground adaptation, dead Entities must be part of the Golaem Physics world. An Entity can be added to be Golaem Physics world by using a Physicalize Behavior. There're different Physicalize Modes which can be used:
- Dynamic Rigid Body: to make the Entities fall using the physics engine
- Kinematic Rigid Body: to add Entities in the Physics world without influencing their postures (e.g. if they're playing a dead-on-the-ground motion)
- Local Servo Rigid Body: to combine animation and physics engine computation (e.g. if they're playing a fall-and-stay-dead-on-the-ground-motion)
Here let's stay in the default Dynamic Rigid Body mode. Unlike the other behaviors, the Physicalize Mode of an Entity only happens when the behavior is stopped (see Triggers to see how to stop a behavior). This allows to control how the previous velocities and inertia will be inputted in the Physics simulation.
And the resulting simulation:
Enable the Ground Adaptation of the Walking Entities
Once the dead Entities have been added to the Golaem physics world, it is possible to configure the Ground adaptation mode of the walking Entities to take them into account. Ground adaptation can be setup using the Adapt Ground Behavior. Here the Adapt Ground behavior is played in parrallel with a Motion Behavior playing a simple walk motion:
As there could be a lot of different objects in the Golaem physics world, the Adapt Ground behavior lets you filter which ones will be taken into account. In the configuration below, only Dynamic Rigid Body Entities of Blue Entity Types Entities will be taken into account. More about filters can be found here.
And the resulting simulation: