Hi All,
Im creating a script that will pop an object’s position towards the camera and at the moment it looks something like this -
function PopOut (){
//Create a temp transform
var TempLookatTransform : Transform;
//Aim the transform at the camera
TempLookatTransform.LookAt(Cam.transform);
//Use the temp transform's orientation to create a world space vector
var RelativeCameraDirection : Vector3 = Cam.transform.TransformDirection (0, 0, 1);
//Use the vector to move the object towards the camera
AnimationParent.transform.localPosition = AnimationParent.transform.localPosition+(RelativeCameraDirection * 2) ;
}
Problem is, I’d love to get rid of the “TempLookatTransform” since I’m only using that as something to aim at the camera.
I feel like there must be a way to make this script way more concise. Can anyone help out here?
Thanks
Pete