Tutorial Request: Realistic PhysX Kinematic Character interaction with physX Rigid Bodies

I would love to know how to make the physx kinematic character interact with objects in a more realistic dynamic way. Currently, the starter game just has objects shoot off and not take into account the force the character places on the object nor does the object take its own weight into account.

With the old physics system the character was a rigid body which automatically handled that. I would love to know how to set that realistic interaction model using script canvas with a kinematic physx character and dynamic physx rigid bodies.

@wcb iirc the YouTube video for the new Starter Game explains that current LY PhysX implementation doesn’t handle these interactions with respect to the relative weight of the colliding bodies. However it suggests this is something that will be in future releases. So hoping that means 1.26 … anyone have more info on this feature?

Hi wcb,

as you mentioned there are two kinds of character controller, dynamic and kinematic, each with different pros and cons. The cry physics controller was dynamic, and PhysX uses a kinematic controller. PhysX uses that approach because of its advantages in terms of more precise control over movement and avoiding some unwanted effects, but it’s a bit trickier to handle interactions with dynamic objects, taking dynamic qualities like mass and momentum into account.

From the point of view of the kinematic controller, it receives a requested movement vector and objects in that path can either completely prevent its motion (e.g. solid walls) or not impede it at all. Any objects in its way which do not stop its movement altogether will be pushed out of the way when it moves, and they can be pushed arbitrarily hard.

However, there are various ways to build effects into the gameplay logic which decides the character’s movement, in order to take dynamic objects into account. For example, the ScriptCanvas graph I attached does an overlap query to find objects in the character’s path, and uses their mass to reduce the velocity requested from the character in the Try Relative Move node.

Could you give us a little more detail about the specific effects you’d like to achieve?

We do have plans to add more example gameplay components to work with the character controller component to provide more functionality out of the box (e.g. gravity, pseudo-impulses from dynamic bodies colliding with the character, exposing more callbacks - including collision callbacks which would allow modifying behaviour for objects collided with by the controller, etc), but those improvements are still some way in the future.

I hope that helps and please let me know if you have any further queries or suggestions.

Best wishes,

David

4 Likes

This video shows the script above attached to the controller. The dynamic body on the right has a mass of 500 kg in the first run, and slows down the character a lot. In the second run the mass is reduced to 100kg and the effect is less drastic.
character controller movement based on mass

this is exactly what i wanted. thank you.