Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Collision problems in 3D

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

Can someone please show me how to do this? I get a simple response between player and 3DObj in a specifik position, but when i start to rotate 3DObj in x,y or z -axis, player still intersects 3dObj at the same spot (start position for 3DObj). I use D3DXComputeBoundingBox for 3DObj, D3DXMatrixRotationYawPitchRoll OR D3DXMatrixRotationY for 3dObj rotations, if that helps... BOOL Collide_BoundingBox() { // player have a start position,player can move in world etc.. // 3DObj have a start position,3DObj can only rotate, let''say y-axis // 3DObj.x ,y ,z is start position // 3DObj.vecMax.x, y, z is the 4 corners (bounding box) // Here is my question... // 3DObj.rotX ,rotY,rotZ is rotation axis // can I use this somewhere below? if(3DObj.vecMax.x + 3DObj.x < player.x ) return false; if(3DObj.vecMin.x + 3DObj.x > player.x ) return false; if(3DObj.vecMax.y + 3DObj.y < player.y ) return false; if(3DObj.vecMin.y + 3DObj.y > player.y ) return false; if(3DObj.vecMax.z + 3DObj.z < player.z ) return false; if(3DObj.vecMin.z + 3DObj.z > player.z ) return false; return true; } What must I do?..or..have I forgotten something? I''m a newbie..and my english sucks..

Share this post

Link to post
Share on other sites
So, you definitely should rotate your bounding box before each collision test. You could just recompute it, and that should give you collision at a different point. But once the object rotates, if you recompute the bounding box in world space, the new bounding box may not be optimal and so the objects may appear to collide when they are not close to touching.

Please review the forum Forum FAQ, since there are maybe a couple of links there to pages that could be helpful. There is a page or two over at gamasutra for example.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post

Link to post
Share on other sites
That helped me some.
But now the only problem is trigometry.I dont know anything
about it. perhaps some one could give me some links..

I used cosf(3DObject.rotY) and I dont know if It''s the best way.I get response only in half "circle" (180degree),
not in 360 degree I wanted. 3DObject origo is not in centre,It''s
on left side, but I dont think that''s the problem..or?

Anyway thx again.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!