• Advertisement

Archived

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

Faceindex in a D3DX8 BaseMesh

This topic is 5473 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 a little bit lazy and therefore use the D3DX8.Intersect function to check for rayintersection with a specified mesh. Now the Intersect function returns the FaceIndex of the face that the ray intersects. How do i retrieve the vertices of that face? I need to get the planenormal of that face to perform a bounce/slide on my object.

Share this post


Link to post
Share on other sites
Advertisement

Hi I was wondering if u got an answer to this problem because I have the same one. If so please could you help me, thanks Dan.


I''m a little bit lazy and therefore use the D3DX8.Intersect function to check for rayintersection with a specified mesh.
Now the Intersect function returns the FaceIndex of the face that the ray intersects.
How do i retrieve the vertices of that face?
I need to get the planenormal of that face to perform a bounce/slide on my object.

Share this post


Link to post
Share on other sites
Hi - have either of you looked at the pick sample that comes with the SDK? After the sample''s code determines mesh intersections, it then determines the vertices of the intersected triangles. You have to scroll down a bit so as to get past the "// Not using D3DX" section.

Based on this code, it looks as if the faces are ordered sequentially - that is face 0 equals (in the mesh''s vertix buffer) vertices 0-2, face 1=vertices 3-5, etc...

I could be reading the code wrong (it''s late), but definitely take a closer look at the pick sample. Everything you need is in there.

-BM

Share this post


Link to post
Share on other sites
may be this is wrong way but i a am DX begginer.

Unlock vertex buffer
You have FaceIndex. as we know FaceIndex and veretx array start from 0.


Vertex1 = (FaceIndex*3) + 0;
Vertex2 = (FaceIndex*3) + 1;
Vertex3 = (FaceIndex*3) + 2;

Lock vertex buffer

there should be a better and fast way. i dont know.

[edited by - DirectXXX on March 2, 2003 2:22:26 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Formula will be differen based on representation of of VB. Strip, TriList or Indexed will need to be calculated differently. You''ll have to figure this on your own. (You are not the only one lazy around)

Share this post


Link to post
Share on other sites

  • Advertisement