Skip to main content
GameDev.net gamedev.net
🔒 Locked

D3DXIntersect

Started by treeway Aug 26, 2006 at 2:55 PM 1 replies 450+ views
Original Post
treeway
treeway
Hi im trying to indicate which triangle my player is standing on in my collision terrain mesh by rendering an arrow model at each vertex of the triangle that the characters down vector intersects with. I got the face index returned by the D3DXintersect method. I thought that the index was the same number as the first vertex in the triangle which is interscted i.e. trinagle verticies = verticies[faceIndex] verticies[faceIndex + 1] verticies[faceIndex + 2] but it seems that this is not the case. How do i get the actual vertex numbers of the triangle from the face index returned from d3dxIntersect?
DonnieDarko
DonnieDarko
FaceIndex is the triangle index in the 'index buffer' which for each triangle holds three indices into the vertex buffer:

triangle vertices = (
vertices[indices[faceIndex*3+0]],
vertices[indices[faceIndex*3+1]],
vertices[indices[faceIndex*3+2]]
)
treeway
treeway
your right! thanks a lot rating++

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.