|
Hey, i've been searching but got no outcome of it.. I want to make a transform to an object, but the transformation script is on his child. so, if i use myTransform = transform.parent; on the child, it does a relative-to-parent transform, but i want it to move the parent (relative to global). any thoughts? *Edited lines where the transformation happens //rotation myTransform.Rotate(0, (int)_turn * Time.deltaTime *rotationSpeed,0); moveDirection = new Vector3(0,0,(int)_forward); //back-forward moveDirection = myTransform.TransformDirection(moveDirection).normalized; moveDirection *= swimSpeed;
(comments are locked)
|
|
A little more info would help like are you using a rigidbody on the parent? If so then just access the rigidbody of the parent and apply movement to that game object. I don't see any actual movement code above so i'll just give u a simple example You can do this in any script. For example... This will move the parent object relative to global like you wanted. Hope this helps
(comments are locked)
|
|
aaaaaaand it worked love you <3
(comments are locked)
|
|
ohh, Space.World, didnt know that! Will try that monday and report back! thx
(comments are locked)
|

I'm not sure what you're asking without more information. Changing the transform for a child occurs as it normally would. Changing the transform for a parent makes all children to the parent transform equally.