- Home /
How to make the child follow the parent's rotation
I have a top-down game with a camera looking flat to the ground (which means it's tilted 90 degrees downwards). I am making a turret rotation that follows the location of the mouse.
I have successfully made it look at the mouse in a flat manner but whenever I go to ramps, it doesn't rotate as the parent as you can see on the screenshots.
Current ship orientation:
Zoomed in to turret:
I have a script on an Empty Game Object which is the parent of the cannon. I currently have this line of codes in the Update()
function
Vector3 v3T = Input.mousePosition;
v3T.z = Mathf.Abs (Camera.main.transform.position.y - transform.position.y);
v3T = Camera.main.ScreenToWorldPoint (v3T);
transform.LookAt (v3T);
How do I make the Empty Game Object to follow the parent's (I'm referring to the ship) rotation?
Your answer
![](https://koobas.hobune.stream/wayback/20220612134037im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Constance Force Rotation not transferring to child object. How to fix? 0 Answers
Snaping/Merging game objects together 0 Answers