Convert Local Position To Global on a Child Object
Hi All,
I'm having a small problem where I'm trying to Instantiate an apple prefab on a tree.
I've set up the position for the apple to be spawned as Vector3's. The example I'm using is setting the Vector3 to (0, 2.5, -1)
Now when my tree object instantiates the apple it will add that Vector3 to it's own position and place the apple at it's correct location.
But if the tree is rotated, which gives more realism, the apple is then in the wrong position as it doesn't get rotated with the object.
I had a quick fix where I backup the trees rotation and Zero it, add the apple as a child object in its position then revert back to it's own rotation. That works but it's a pain especially if I have multiple trees with multiple apples.
Is there an easier solution such as adding the apple at a local position to the tree which would take in to account the rotation?
I'm now currently using Empty GameObjects as they will stay in the set position and will move with the trees rotation.
Thanks
Tommy
Your answer
Follow this Question
Related Questions
Real life frame position to relative position to camera rotation 0 Answers
Unity 3D C# - Rotation To Slope Of Terrain 0 Answers
some Instantiated models are start rolling after getting Instantiated. 0 Answers
Character Shooting Mechanic 2D Issues 0 Answers
Im having an issue when Instantiate Prefab with specific rotation 2 Answers