- Home /
LookAt facing Upwards
var target : GameObject; var damping = 6.0; var smooth = true;
function LateUpdate () { target = GameObject.FindWithTag("LookAtMe");
LookAtBackwards(target.transform.position); }
function LookAtBackwards(targetPos: Vector3) { var offset: Vector3 = transform.position - Vector3.up; transform.LookAt(transform.position - offset); }
So far I'm able to reverse the forward of my object, but I want the bottom of the objects transform to face the LookAt target instead.
Any ideas, Thanks - C
Answer by Kourosh · Apr 16, 2011 at 05:26 PM
Simple solution, define a new pivot:
1.Create an empty gameobject.
2.Make this empty the parent of your main object.
you need to change the rotation of the main gameobject to check whether it gives you what you want after making it a child of that empty go.
Now you can simply attach your script to the parent.
Hope it helps.
I've been using that method, but I thought there may be a "proper" program$$anonymous$$g solution.