newbie question.
I’m trying to instantiate, as a child of a sphere, a plane object which is translated and it should rotate around the center point of its parent.
RotateAround does the right job allowing the plane facing to the center, but LookAt doesn’t. The plane starts aligned by one axis and it doesn’t look to the center.
Attached to the parent sphere:
var prefab : GameObject;
var rnd : float = Random.value*10+2;
var myobject : GameObject = Instantiate(prefab, Vector3(rnd, rnd, rnd), Quaternion.identity);
myobject.transform.parent = transform;
myobject.transform.LookAt(transform);
Attached to the child plane:
function Update () {
transform.RotateAround (transform.parent.position, transform.parent.right, 1);
}
any help would be appreciated
fabio