#### Archived

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.

## 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 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 on other sites
thx
That helped me some.
But now the only problem is trigometry.I dont know anything

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.

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
15

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009183
• ### Who's Online (See full list)

There are no registered users currently online

×