• Advertisement
Sign in to follow this  

Get bounding box normal

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

Hi. I need the normal vector to compute the "sliding" vector. Here is an image, what i want: http://ilab.hu/jf/datas/users/1403-bbox.png I've axis aligned, object oriented and local space bounding box, but the player position is in world space. Any idea? thanks, csisy

Share this post


Link to post
Share on other sites
Advertisement
I've got a new idea: I'll use collision meshes. I know the player current and the next position. I tried to test it, but it isn't work... :(

D3DXVECTOR3 lPP; //local player current position
D3DXVECTOR3 lPPN; //local player next position
D3DXMATRIX iw; //inverse world matrix
D3DXMatrixInverse(&iw, NULL, &models[0]->GetWorld());
D3DXVec3TransformCoord(&lPP, &player->GetPosition(), &iw);
D3DXVec3TransformCoord(&lPPN, &player->GetPositionNext(), &iw); //transform player positions into local space
BOOL collide;
D3DXIntersect(models[0]->GetMesh(), &lPP, &lPPN, &collide, NULL, NULL, NULL, NULL, NULL, NULL);

And to test, simply:

if (collide)
game->GetDevice()->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);

I think like this:
- ray-mesh
- ray-meshtriangle
- get selected triangle normal
- sliding

Share this post


Link to post
Share on other sites
Well, since you have the box corners in world space, you can subtract, for example the "far_lower_left" corner coordinate from the "far_upper_left" corner to get the "up" direction of the box.

Share this post


Link to post
Share on other sites
Quote:
Original post by solenoidz
Well, since you have the box corners in world space, you can subtract, for example the "far_lower_left" corner coordinate from the "far_upper_left" corner to get the "up" direction of the box.

yeah, it's clear, but I won't use bounding boxes, 'cause, I've some "erratic"(?) mesh.
I need ray-triangle collision (ray and collision mesh, of course), and compute the "selected" ray's normal.

Share this post


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

  • Advertisement