3D object Direction
by Will O-Reagan · in Torque X 2D · 05/07/2008 (5:18 pm) · 1 replies
Is there a way to set a direction, or get a direction, of my Camera? in a Vector 3?
About the author
I have a degree in dramatic art, and literature, from UC Santa Barbara. I've worked for a few studios, also at Animax Ent in 2008, and some smaller studios. Currently studying Computer Science at CSU Channel Islands.
Torque Owner Russell Bishop
Default Studio Name
So that would make the camera's facing direction:
If you want the camera to face an object and be a certain distance from it, just attach it to the object and give it a position offset (distance from object). Or you can calculate the camera's transform manually if you like. Take that object's transform, apply some translation to it (for example negative Y to move away from the object), then use that for the camera's transform.
Note that you would probably need to take the object's transform, save off and zero out the translation giving you rotationMatrix, then take the original transform and add Vector3.Transform(cameraOffset, rotationMatrix). That way instead of moving negative Y you will move backwards from the object, no matter which way it is rotated.