Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With my many hours of frustration implementing camera systems Id suggest its something to do with your view matrix not being ortho-normalized. Thats a fancy way of saying - the three vectors represented in the matrix are not kept to the length of 1 (normalized) and also not orthogonal (at 90 degrees to each other). </p> <p>The 3x3 part of a view matrix representing rotation represents 3 vectors that describe the current x,y and z axes of your view at any given time. Due to rounding off errors caused by the imprecision of float values these three vectors can stretch, shrink and diverge to cause all manner of headaches. </p> <p>So a general strategy is re-orthonormalize every few frames if rotating and also another thing - when strafing or moving back/forward change the position using the current value of your view/lookat vector for back/forward and right vector for strafing.</p> <p>e.g</p> <pre><code>//deltaTime for all of these examples is the amount of time elapsed since the last //frame of your game loop - this ensures smooth movement, or you could fix your //timestep - Glen Fielder did a great article on that please google for it! void MoveForward(float deltaTime) { position += (deltaTime * lookAtVector); } void MoveBackwards(float deltaTime) { position -= (deltaTime * lookAtVector); } void StrafeLeft(float deltaTime) { position -= (deltaTime * rightVector); } //do something similar for StrafeRight but use a += </code></pre> <p>Anyway for the rotations just rotate the view and right vectors, maybe re-write your class as follows</p> <pre><code>class Camera { Vector3 rightVec,lookVec,position; void Rotate(float deltaTime) } </code></pre> <p>You get the idea? Thats a rough example just to get you thinking.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload