Sign in to follow this  

About Havok Simulation

Recommended Posts

Hi: There is a terriable problem which troubled me some of days.Havok has a current simulation time.I can get it from hkpWorld::getCurrentTime().Now,I have two boxes,I set them pos and speed property every frame.I found in a different simulation time point,although I set same value that I can't get same collision point from Havok.How can I get same collision result with same input?Thanks

Share this post

Link to post
Share on other sites
I have a few questions:

1) Since you are updating the position every frame, my assumption is that you
intend your objects to be purely kinematic objects, which Havok itself
doesn't integrate. Is this correct? It's fine that you choose to do this,
but please verify that you have properly configured your objects to be
kinematic. If your set position is fighting with Havok, I'm not sure you
can expect predictable results.

2) Have you configured the system to use continuous collision detection
features? These are often more expensive than simpler collision detection,
and engines sometimes allow you to turn them on or off. They may be
off by default, and may not be supported for all object types. If you
do not have continuous collision detection enabled, there is a better
chance that the collision detection results will be sensitive to the
frame time step and so you wouldn't be able reproduce exactly the same
result at a different frame time. But, read on.

3) Have you tried using a fixed physics time step, e.g., instead of using
the frame's delta_t, always use, say, delta_t = 1/60 second, and run
enough physics integrations at each frame to catch physics up to the
current game time? Even when trying to detect collisions between purely
kinematic objects, you shouldn't expect precisely repeatable results
if you are using different time steps. The collision detection system
will be sensitive to the time step variations.

Hope those questions and comments help!

Share this post

Link to post
Share on other sites
If you're driving the bodies manually, i believe the Havok term is Keyframed.

Also, i'm not sure how you're querying the contact points. There's lots of ways, you could just do a shape query on another shape. If you pass it two shapes in the same configuration repeatedly, it should give you consistant results.

It sounds like you're trying to do the job for havok though. Why are you querying the time, shouldn't you be telling it the time? Letting it worry about collisions and positions of the bodies?

Share this post

Link to post
Share on other sites
Havok doesn't like setting position every frame. Why are you doing this? If you set the position every frame, what do you expect setting the speed to do?

If you want to set the velocity, use impulses and forces. If you want to set the position, change your object to be keyframed and use the utilities Havok provides for setting the position.

Good luck!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this