Ok, I want to reverse engineer a look-at code to be a look-away code. In order to fix a problem with my previous aiming mechanism*** I decided to make the shooter part rotate in the same direction as my camera (rather than have my camera be the point that it’s attached to, like an FPS). Is there a way to make a look-at code: (something like this)
var cameraToLookAt: Camera;
function Start()
{
cameraToLookAt = Camera.main;
}
function Update()
{
var v: Vector3 = cameraToLookAt.transform.position - transform.position;
v.x = v.z = 0.0;
transform.LookAt(cameraToLookAt.transform.position - v);
}
Into a look-away code? (Note, that code only aims in one rotation axis, I would need all three for it, but I used it as an example). Basically I will be looking in the SAME direction as my camera. not the complete opposite.
***My orignal planning relates to FPS logic, where the camera is always at the character’s eyes. However, because I can zoom my camera in and out, it messes up where I shoot from. I just want the angle.