Terrain Navigation
Wasn''t obvious to me, either, C_Guy.
Maybe you should explain your problem a bit better when you ask for help, Raptor. I doubt you''ll get a saitisfying answer from a one sentence question - try explaining the engine you are using, whether the character is in the buggy or looking at it etc. etc.
Regards,
WhiteWolf
Maybe you should explain your problem a bit better when you ask for help, Raptor. I doubt you''ll get a saitisfying answer from a one sentence question - try explaining the engine you are using, whether the character is in the buggy or looking at it etc. etc.
Regards,
WhiteWolf
The approach I''m contemplating is to:
1. calculate the terrain altitude at each point the vehicle moves to. This is done by interpolating between grid points.
2. add that amount to the center (zero) of the vehicle.
3. calculate the slope of the terrain at that point.
4. rotate the vehicle pitch and roll accordingly.
Presumably this can be done in with a single matrix...
1. calculate the terrain altitude at each point the vehicle moves to. This is done by interpolating between grid points.
2. add that amount to the center (zero) of the vehicle.
3. calculate the slope of the terrain at that point.
4. rotate the vehicle pitch and roll accordingly.
Presumably this can be done in with a single matrix...
well this is what i have done to create the object matrix-
here vTriangle[0..2] has the vectors for the vertices of the triangle the object is over.
well it works fine but my object is upside down.
why??
///////////////////////////////////////////////////////////
D3DVECTOR UP,vector1,vector2,right,look;
m_MeshObject[meshno].vLoc += m_MeshObject[meshno].vDir * m_MeshObject[meshno].fSpeed;
FindTerrainTriangles(m_MeshObject[meshno].vLoc.x,m_MeshObject[meshno].vLoc.z);
vector1=vTriangle[0]-vTriangle[1];
vector2=vTriangle[2]-vTriangle[1];
UP=CrossProduct(vector1,vector2);
UP=Normalize(UP);
right = CrossProduct(UP,m_MeshObject[meshno].vDir);
right = Normalize(right);
look = CrossProduct(right,UP);
look = Normalize(look);
m_MeshObject[meshno].matLocal._11=right.x;
m_MeshObject[meshno].matLocal._21=right.y;
m_MeshObject[meshno].matLocal._31=right.z;
m_MeshObject[meshno].matLocal._41=m_MeshObject[meshno].vLoc.x;
m_MeshObject[meshno].matLocal._12=UP.x;
m_MeshObject[meshno].matLocal._22=UP.y;
m_MeshObject[meshno].matLocal._32=UP.z;
m_MeshObject[meshno].matLocal._42=m_MeshObject[meshno].vLoc.y;
m_MeshObject[meshno].matLocal._13=look.x;
m_MeshObject[meshno].matLocal._23=look.y;
m_MeshObject[meshno].matLocal._33=look.z;
m_MeshObject[meshno].matLocal._43=m_MeshObject[meshno].vLoc.z;
m_MeshObject[meshno].matLocal._14=0;
m_MeshObject[meshno].matLocal._24=0;
m_MeshObject[meshno].matLocal._34=0;
m_MeshObject[meshno].matLocal._44=1;
///////////////////////////////////////////////////////////
thanks!!
The only way around it is Through it!!
here vTriangle[0..2] has the vectors for the vertices of the triangle the object is over.
well it works fine but my object is upside down.
why??
///////////////////////////////////////////////////////////
D3DVECTOR UP,vector1,vector2,right,look;
m_MeshObject[meshno].vLoc += m_MeshObject[meshno].vDir * m_MeshObject[meshno].fSpeed;
FindTerrainTriangles(m_MeshObject[meshno].vLoc.x,m_MeshObject[meshno].vLoc.z);
vector1=vTriangle[0]-vTriangle[1];
vector2=vTriangle[2]-vTriangle[1];
UP=CrossProduct(vector1,vector2);
UP=Normalize(UP);
right = CrossProduct(UP,m_MeshObject[meshno].vDir);
right = Normalize(right);
look = CrossProduct(right,UP);
look = Normalize(look);
m_MeshObject[meshno].matLocal._11=right.x;
m_MeshObject[meshno].matLocal._21=right.y;
m_MeshObject[meshno].matLocal._31=right.z;
m_MeshObject[meshno].matLocal._41=m_MeshObject[meshno].vLoc.x;
m_MeshObject[meshno].matLocal._12=UP.x;
m_MeshObject[meshno].matLocal._22=UP.y;
m_MeshObject[meshno].matLocal._32=UP.z;
m_MeshObject[meshno].matLocal._42=m_MeshObject[meshno].vLoc.y;
m_MeshObject[meshno].matLocal._13=look.x;
m_MeshObject[meshno].matLocal._23=look.y;
m_MeshObject[meshno].matLocal._33=look.z;
m_MeshObject[meshno].matLocal._43=m_MeshObject[meshno].vLoc.z;
m_MeshObject[meshno].matLocal._14=0;
m_MeshObject[meshno].matLocal._24=0;
m_MeshObject[meshno].matLocal._34=0;
m_MeshObject[meshno].matLocal._44=1;
///////////////////////////////////////////////////////////
thanks!!
The only way around it is Through it!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement