Of Unity basics, it’s easy to make object child of another parent object (join with Hierarchy panel) this is not the problem …
suppose a scene contains rigidbody sphere moving with arrow keys, inside this sphere a gameobject, this gameobject child of sphere, the question here:
How can make this gameobject not follow sphere rotation, but follow sphere position only?
ivkoni
March 4, 2010, 9:46pm
2
overwrite the child rotation every frame. Or don’t make the child a child of the sphere, but assign the sphere position to the child position every frame.
can you explain with script guide lines, if you please
ivkoni
March 5, 2010, 2:49pm
4
var childTransform : Transform;
function LateUpdate() {
childTransform.rotation = Quaternion.identity;
}
or
var childTransform : Transform;
var parentTransform : Transform;
function LateUpdate() {
childTransform.position = parentTransform.position;
}
or just attach this to your child object so that it it stays at rotation (0,0,0);
function LateUpdate() {
transform.rotation = Quaternion.identity;
}
you helped me with these few lines…
Thanks … (“Shokran” in Arabic)