Improvements to Character, Kinematic RigidBodys and GhostObject

Hey monkeys,



given all the posts about the bullet character and about people wanting to use physics as collision detection rather than physics simulation I have made some improvements to the physics controls:



CharacterControl

The CharacterControl now has no rotation value anymore (as it was not working anyway) but the CharacterControl got a new parameter “viewDirection”. The character spatial is automatically rotated to look in the given “viewDirection” which is separate from the walkDirection. I also added the latest improvements to the character from native bullet to jbullet (some jumping and slope handling improvements).

A personal fix thats not even in the native bullet yet, I also made the Character not collide with GhostObjects, so one can trigger characters entering GhostNodes without the character bouncing off the GhostObject.



GhostControl

The GhostControl now moves with the spatial it is attached to by default. That means you can attach a GhostControl to a spatial to do collision checks without physics feedback (e.g. NPC “attack radius” or other collision checks).



RigidBodyControl (kinematic)

The RigidBodyControl now has a setting setKinematicSpatial() which is true by default. When enabled and the RigidBody is set to kinematic mode, the RigidBody will be moved according to the Spatials location. Possible uses would be a self-made character or objects on MotionPaths with physics collision.



General

When enabling/disabling the control, the physics object is removed from / added to the physics space so there wont be any collisions when disabling. When its enabled again, the location/rotation of the Spatial is applied to the physics object before adding it to the physics space again. This allows you to disable physics on an object shortly for animation purposes and then reenable physics after the animation has been done (e.g. player picking up object and putting it someplace else).



Cheers,

Normen

1 Like

It seems very useful! :o

Thank you for the improvement.