float AngleofVectorT(Vector3 V){ return (atan2(V.x,V.z));}void RenderWalkMode(){ glPushMatrix(); glTranslatef(WalkMode.Position.x,WalkMode.Position.y,WalkMode.Position.z); float angle=AngleofVectorT(WalkMode.Direction)*180.0f/PI; glRotatef(angle,0,1,0);//Generate rotation RenderModel();//it`s actually bigger in my case :p glPopMatrix();}
turn model to face direction of movement
I don`t know about you but I use this and it wortks perfect so far->
Relative Games - My apps
what's "WalkMode.Direction" ? the vector created by
CurrentPosition - EndPosition?
CurrentPosition - EndPosition?
didalabu2: In OpenGL, the default camera orientation is that object inside the screen have negative Z coordinates. It's a common mistake to assume that axisX=normalize(cross(axisZ,up)), because in fact it's axisX=normalize(cross(-axisZ,up))=normalize(cross(up,axisZ)).
I would even say that axisZ=-normalize(look-eye).
cippyboy : this equation works with flat world viewing, eg a FPS-style game like Doom or Doom II. I mean, you can't look up or down with this method, and I think didalabu2 would need to.
I would even say that axisZ=-normalize(look-eye).
cippyboy : this equation works with flat world viewing, eg a FPS-style game like Doom or Doom II. I mean, you can't look up or down with this method, and I think didalabu2 would need to.
[didalabu2]
WalkMode.Direction functions like a direction, I actually normalize it and use it for walking in all directions :)
[vincoof]
I can say that I ca perfectly look up and down with my methods(there`s more code in it than just the rendering part), I`ve completed a full third person camera that functions quite OK :), I actually had to equalize y with 0 so that the WalkMode will not... "fly" :p
WalkMode.Direction functions like a direction, I actually normalize it and use it for walking in all directions :)
[vincoof]
I can say that I ca perfectly look up and down with my methods(there`s more code in it than just the rendering part), I`ve completed a full third person camera that functions quite OK :), I actually had to equalize y with 0 so that the WalkMode will not... "fly" :p
Relative Games - My apps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement