I need to create a script that allows an Object to rotate while the other parented object Does not, how would i go about doing this?
Edit: Or would it be easier to create a script that mimics movement of an object?
I need to create a script that allows an Object to rotate while the other parented object Does not, how would i go about doing this?
Edit: Or would it be easier to create a script that mimics movement of an object?
Well, if you don't want them to rotate together, are you sure that using transform parenting is the way to go? Copying an object's position is as simple as using
using UnityEngine;
public class FollowTransform : MonoBehaviour {
// Assign in the editor the transform you want to follow;
public Transform target;
void LateUpdate()
{
transform.position = target.position;
}
}
And that way it doesn't scale or rotate with the parent the way a transform child would.
Of course, there might be a very good reason for wanting them in the same hierarchy (for SendMessage purposes, etc.). In that case, the answer will change a little.