- Make them move using either Locomotion, Motion , Navigation... behaviors.
- Add the Physicalize Behavior in parallel with the current motions.
- Add a end trigger to start the physics and make sure the Parrallel operator will stop as soon as one behavior ends.
- Add a Force Behavior after the Parallel Operator and do not forget to set its Stop Trigger
- Add a Physicalize Behavior set to dephysicalize and set its Start Trigger condition
- Why are my characters not switching to Dynamic mode?
- What are the best practices for customizing physical shape?
- How to prevent characters from exploding when their neighbour is physicalized?
- How to keep the current velocity of the character when switching to dynamics?
- How to check if/when a character is physicalized?
- Even when switched to dynamic mode, my characters do not bend and stay really straight
- I used the Physics Collision Trigger to start a behavior but it is never started
- I used the physics collision trigger and behaviors start unexpectedly
- I want to control the position of a dynamic character, but it always stays in the same place
- Why does my characters explodes in a wicked way when physicalised?
- Crash after a warning message: "The number of rigid bodies in the simulation now exceed 65535"
- Why does my scene crash when my characters starts to physicalize?
- Why does my character go crazy when physicalised
- Why do my ragdolls go trought the environment or rigid bodies ?
The Character Maker auto-computed physics properties do not always yield the best results, so it's better to spend a little time customizing them.
deactivate all bones which are not required in the physics simulation
E.g. all fingers parts should not be physicalized, because they are not significant enough, and will use a lot of computation for nothing. Their shape should be approximated by a bigger hand or foot bone
capsules generally yield better results than boxes.
root bone needs to be physicalized, but not every bone from the spine. Try the combination of physicalized spine bones which matches best the shape of your character.
joint limits: remember that no limits is -360 / +360. Setting a joint limit of 0 / 0 on all axes means that your joint is blocked and it is not a good thing for the physics solver which has to dissipate energy one way or another. It is always best not to use too strong limits and strengthen them progressively where needed
- Other parameters than shape/size/limits can be helpful but it is advised to first perform a test with default values before changing them. See Physics Properties for the complete description.
Before designing your behaviors, it is important to understand how physics simulation work.
See the physics simulation world as a separate reality from the crowd simulation. It means that when a character is simulated with Golaem Crowd it may or may not be in the physics simulation world (actually it may even have only some body parts in the physics world).
So depending on which mode you have set with the Physicalize Behavior, each character (or character part) can be in on of the following states:
- Only in the crowd world, not in the physics simulation world: when no Physicalize Behavior has been run yet, or if it has been dephysicalized
- In the physics world, but controlled by classic behaviors (Motion, Locomotion...): when set to Kinematic Mode
- In the physics world, but static; when set to Static Mode
- In the physics world, controlled by physics simulation: when set to Dynamic Mode
It is important to understand that a physics simulation always aims at reaching an equilibrium in terms of collisions and applied forces. It is tempting to have characters in the crowd world, and switch to dynamic mode at the last moment when something happens. However it means that a character will suddenly pop in the physics world and can completely break this equilibrium and make physics simulation go crazy (exploding/flying characters).
In these cases, the best thing to do is to set every characters in Kinematic mode from the start of the simulation. It is a bit more time-consuming but it will ensure that when you switch your character to dynamic mode, the physics simulation solver will not be taken by surprise.
The physicalization/dephysicalization of an Entity only happens when the Physicalize behavior is stopped. Depending on the use case, a delay between the starting and the stopping of this behavior (with the Behavior Mode set to Physicalize and the Physicalize Mode set to Dynamic Rigid Body) should be respected:
- If you need to keep the velocities from previous frames, the Physicalize Behavior should be stopped at least 2 frames after its start (use the Behavior Time Trigger to let the behavior stop after X frames).
- If you do not care about previous speed (maybe because characters are not moving), you can start and stop the behavior at the same frame (use the True Trigger to let the behavior stop at the same frame than its start).
In the following example:
- Green Characters have their Physicalize behavior which starts and stops at the same frame: speeds are not taken into account and they just fall on the floor.
- Blue Characters have their Physicalize behavior which stops one frame after it starts: speeds are taken correctly into account, but acceleration is wrong which results into an unwanted force being generated. This is definitely not what you want.
- Yellow Characters have their Physicalize behavior which stops two frames after it starts: speeds and accelerations are correctly taken into account
Activating the Bounding Boxes mode of the Physics Locator will display blue boxes around the physicalized characters in the Maya viewport. Otherwise it is impossible to know e.g if a character is in kinematic mode or not.
Either the joint limits are not configured correctly (open your character file in the character maker and check physics properties), or the force is really applied the same way on the whole body. In this later case, you can used body masks on the Force Behavior in order to get your characters to achieve different effects (e.g. apply force only on left part of body to get a rolling effect, or only on the head for a headshot...).
Guess what? Physics collision between two characters can only be detected if they are both in the physics world. For a character to be able to trigger a behavior using the physics collision trigger, it needs to be physicalized (at least in Kinematic mode)
First, remember that the physics collision trigger uses the bounding boxes of each physicalized limb to compute the collision, so it may starts behavior when characters are not exactly colliding but are very close.
However another frequent reason for a physics collision trigger unexpectedly starting is that if the crowd is dense and a lot of characters are already in Kinematic mode, they may be colliding a bit with each others. However you do not want all your soldiers to fall down each time they touch each others' pinky! That's why a filter has been added on the Physics Collision Trigger.
Usually what you want is to start your behavior when a kinematic mode character (walking soldier) is hit by a dynamic mode one (arrow, other soldier flying in the air...). In this case use the "collide with dynamic mode entities" filter on your Physics Collision Trigger.
If you want to control the position a a dynamic character (e.g. with maya fields, AdaptPosition behavior...) it is best not to put it's pelvis in Dynamic Mode (see Body Mask Attributes)
Have you clicked "Check Scene Settings" in the Crowd shelf ?
Your linear working unit may not be set to centimeter.
Always remember when using Golaem that it will only works in this linear unit. When using another unit the simulation results might be totally weird due to extreme physics values applied to the characters.
There is a limitation in Nvidia PhysX about the number of rigid bodies that can collide with the axis aligned bounding box (AABB) of another rigid body that makes the simulation crash.
Unfortunately, there is no easy way for Golaem to prevent from this crash, so whenever the total number of rigid bodies in the simulation exceed 65535, this warning is displayed:
"The number of rigid bodies in the simulation now exceed 65535. If a single AABB object collides with all of them, the physX simulation will crash. Please contact firstname.lastname@example.org if you experience a crash after this message."
The good news is that it is usually totally fine to continue using the simulation with more than 65535 rigid bodies, the only exception is when there is a huge object (usually the environment) that may collide with all the simulated entities at once. If such a thing occurs, the best way to solve this is to divide the objet in several smaller objects that won't collide with as much entities that the whole one.
You have a very large scene with many entities in it and you would like to physicalize all of them but your scene keeps crashing every time you press play. Check your script editor, you should have this message popping.
When exceeded the number 65535 rigid bodies in your scene please pay extra attention to the Physics environment as your ground is maybe colliding with every entities
The workaround would consist in splitting this big Rigid Body into multiple geometries and to convert it into separate Crowd Rigid Bodies. The physical collisions will be much easier to compute. Also don't forget to put your Physics Locator Environment Mode to none.
Have you checked your character's Physics Shapes? Maybe your character has many physicalized bones which are overlapping, which results in physics instability.
Edit your character's ragdoll so each Physics Shapes overlaps with their direct neighbors only.
Your character should now fall naturally.
This usually is due to the way the environment or the rigid bodies were built.
Please read this section of the documentation.