Game Development Reference
In-Depth Information
How it works...
The actual code is a fairly straightforward trigonometry, but knowing what values to use
and the flow of doing it can be tricky.
Once the class receives an object to look at, it subtracts the model's
worldTranslation
from
lookAtObjects
so they end up in a coordinate system that is relative to the mod-
el's origo point also called
modelspace
.
Using
setUserTransformsWorld
also sets the position, but since we supply its cur-
rent
modelSpacePosition
, no change will be applied.
Actually, the direction of each eye should be calculated separately for the result to be en-
tirely correct.