Jump to content
  • Advertisement
Sign in to follow this  
Hannesnisula

Accessing face normals in D3DXMESH etc

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

I'm working on some kind of collision detection and I need the face normals to calculate the new vectors etc but I have no clue how to get the face normals from the D3DXMESH class. There's a D3DX function called D3DXIntersect which returns the face of the mesh that the ray hit. How could I then (if I can access the face normals somehow) get the face's normal when I've got it's indexnumber? I'm thinking about creating my own intersection function but I don't know how to check if the ray intersects with the world (since it has no bounding box/sphere w/e) even though I've got a pretty good idea how to do it with bounding spheres/boxes.

Share this post


Link to post
Share on other sites
Advertisement
The face normals aren't stored in the D3DXMESH structure, you'll have to calculate them yourself I'm afraid. You can access the triangle information using the vertex and index buffers in order calculate the face normal.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!