Jump to content
  • Advertisement
Sign in to follow this  
MartyrOfKharak

[ODE] Collisions at Large Distances From Origin

This topic is 2533 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using ODE, compiled using double precision, with DirectX. All of my world objects use vectors comprised of 3 doubles to represent their current positions, and when rendering time comes their world matrices are created relative to the camera. The physics simulation works great when reasonably close to the origin.

However, I am using double precision because I need to simulate objects at huge distances from the origin of the coordinate system. Several AUs at the very least.

The movement simulation works fine at large distances from the origin. Objects orbit planets several AUs from the sun (origin of the system) accurately. There's no simulation jitter.

The problem arises when any objects are supposed to collide: the collision is simply not detected. Whether the objects be trimeshes or boxes or spheres, nearCallback is never called. Oddly enough, when I create an ODE's infinite plane as a floor, objects will come to rest on it regardless of their distance from the origin.

I've checked the position of the geom against the object's position in the world, and they always match up perfectly. dDOUBLE is declared, and I'm creating my Direct3D device with D3DCREATE_FPU_PRESERVE so it's not accidentally switching to single precision.

I hope there are some ODE experts in the house, because this has been puzzling me for more than a month.

Share this post


Link to post
Share on other sites
Advertisement
What type of space are you using? Try using all the various spaces. Some may have implicit or explicit maximum bounds.

Also, just to make sure the space is your only problem, try calling nearCallback manually and ensure that collisions are reacting as expected.

The spaces, and process before nearCallback is called the broadphase, and is purely an optimization. You can bypass it in your case (few sphere objects)

Share this post


Link to post
Share on other sites
Thanks for the speedy reply.

I was originally using a hash space, and when I try with both a quad space and a simple space there is no change.

I tried calling nearCallback manually on the two ships, but dCollide is always returning 0 contacts.

I would prefer to not skip the broadphase, because eventually there will be many interacting objects.

Share this post


Link to post
Share on other sites
at what distance does collision detection stop working? in units.

Can you write a test that slowly pushes the objects away from the origin until they stop reporting collision?

When you find that point, try to change the size of the shape and see if collisions are reported again.

A really small object may alias to a zero size when its' very far from the origin, using floating point precision.

Share this post


Link to post
Share on other sites
for very large worlds you'll likely need to break up the coordinate space so that you can keep "close to 1.0" precision for all of your computation.

If you know two ships are in a similar sector, then you treat the center of that sector as the origin and compute the ships relative to that new coordinate space. Only when you need to compute between distant sectors would you concatenate the sector's transform to obtain a universe transform.

You could start simply by adjusting your unit size. instead of 1meter, try 1mile, etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!