Jump to content
  • Advertisement
Sign in to follow this  

How can I force two shapes to intersect with small velocities?

This topic is 3037 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

If I have a touching contact where tEnter = 0.0f how can I force the moving shape into the other shape in the collision pair so that they are intersecting?

For example if I have a shape moving with a velocity of:

{X:0.02845758 Y:8.023456E-11 Z:0}

and the contact has an entry time of 0.0f. How then can I make sure the two colliding shapes intersect?

if (finalContact.tEnter == 0.0f)
// Touching contact, move shape by a small amount to make sure it is intersecting (the following doesn't work)
//Vector3 v = Vector3.Normalize(velocity);
shape.Position += velocity;

if (Detection3D.TestStaticShapeShape(shape, shape2, ref currentContact))
shape.Position += currentContact.nEnter * currentContact.penetration;

This way TestStaticShapeShape will always solve the interpentrating shapes should tEnter be 0.0f.

EDIT: Almost parallel movement is a pain.

[Edited by - Spa8nky on August 23, 2010 5:55:01 AM]

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!