problem with camera

Topics: User Forum
Mar 18, 2009 at 2:25 AM

sorry for this probably trivial question, but can you tell me how to make model movement (eg in dwarf example) independent from camera? when i try to use animation component in my code and when i draw the model , it is always moving with my camera...


Apr 17, 2009 at 4:02 PM
in order to set a fixed camera, u should just avoid updating it!
Just set it's position in the viewMatrix (position & target) once & then don't update it anymore.

viewMatrix = where the camera is & where it's looking at
worldMatrix = imagine it like the position of the hand holding a pencil that's going to draw the model wherever u tell it to.
projectionMatrix = does it have to draw things that are closer or further than "distanceYouSet" value? (+ aspect ration & stuff).

so to move the camera u just change the values of viewMatrix.
to move (or draw) things in other locations u change the value of worldMatrix.

I think that when the dwarf rotates / translates, the viewMatrix is being updated (maybe in the Update method). Try commenting this lines (but don't forget to initially set up the viewMatrix (so it's pointing to somewhere).

Hope this helps!
Good luck,