Jump to content
  • Advertisement
Sign in to follow this  
Hawkblood

Collision bounce vector?

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

Ok. I have two 3D objects. One is moving and the other is stationary (and very large). I can detect where in space the collision will occur using

D3DXIntersect(...). What I can't figure out is how to determine the "bounce" vector. The stationary object is not a simple box/sphere-- it's a space station. I have made a simplified mesh for the purposes of collisions.....

 

I think my only option is to get the face normals from the mesh and reference that for each hit.

 

Any other ways?

Share this post


Link to post
Share on other sites
Advertisement

Looks like it returns the face hit (nearest to the ray origin, so the first face hit along the ray) through *pFaceIndex (you can get all the hits using ppAllHits as well it seems). You should be able to get the face normal from that (you do want to store the face normals as well as the vertex normals for collision meshes).

 

Then reflect the ray from the hit point using the standard reflection formula (here: http://www.3dkingdoms.com/weekly/weekly.php?a=2). You could also interpolate the (vertex) normals using the barycentric UV coordinates returned through *pU and *pV if you wish (to approximate a curved surface).

Edited by Paradigm Shifter

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!