parent child rotation

Hi,

I have a gameobject which is parent of other gameobject,so i have parent and child objects.

I want to be able to rotate the parent object but to leave child object to always look up direction.

When i rotate the parent object i can see its euler value change,but the child object is always (0,0,0).

How can i make the child object to look some vector( let say up ) constantly?

You can place a script on the child object that makes it be aligned the way you want.

// To keep a constant global rotation:
var myGlobalRotation : Vector3;
function Update () {
    transform.rotation = myGlobalRotation;
}

Or:

// To make the object z axis look at some point:
var myLookAtTarget : Vector3;
function Update () {
    transform.LookAt(myLookAtTarget);
}

Or:

// To make the object y axis keep pointing up:
function Update () {
    transform.up = Vector3.up;
}

you need to remember your camera’s rotation:

	void Start () {
		fixedRot = gameObject.transform.rotation;
	}
	
	// Update is called once per frame
	void Update () {
		gameObject.transform.up = fixedRot;
	}