Problems transforming Kinematic/Static object to Dynamic

Post Reply
dario
Posts: 1
Joined: Tue Nov 29, 2011 11:16 am

Problems transforming Kinematic/Static object to Dynamic

Post by dario » Tue May 22, 2012 8:48 am

Hi,

I am solving collisions with static/kinematic objects that afterwards need to be dynamic in a way that is giving me some problems.

I was wondering if I am doing something wrong or there are better alternatives.
Here is an example of the problem:

* I am simulating vehicle traffic using animated entities with a Kinematic box attached to them.
Once the box detects a collision with certain objects which are dynamic rigid bodies, I transform the traffic vehicle's attached kinematic box into a dynamic one in order to react properly to the collision.

The transition between kinematic and dynamic is triggered by the gContactAddedCallback.
When the traffic vehicle receives this callback I set a flag that in the next update will remove the kinematic box and create a dynamic one in its place.

This works... but not too well.

Since I have to wait to the next update to swap kinematic box for a dynamic one (during the call back I cannot add/remove objects to the simulation... am I correct?) the vehicles have moved a bit and their rigid bodies are inside each other.
This results in a very unrealistic collision where the vehicles jump up (looks like an explosion) in order separate their collision boxes.

I was wondering if there is a better way of doing this.
Can I change the nature of a rigid body (e.g. from static/kinematic to dynamic) before the next update?

Please bear in mind that I need at this stage the traffic vehicles to be animated, so to change this right now is not an option.

Thanks in advance

Dario

Post Reply