- Home /
Calculate offsets correct?
Hello,
i want to a child object (weapon) to have the same position as another object (camera -->no child) by changing the (local-)Position from the parent object (hand palm) of the child
Other explanatation: (i want to calculate the position of an parent object (hand palm) so that a child object (weapon) has the same position like another object (Camera))
Answer by Captain_Pineapple · Jun 25, 2019 at 11:26 AM
If i understood your problem correctly it should be something like the following:
parent.localposition = target.position - child.localRotation*child.localPosition
Though no guarantee on that, i did not test it. Theory should be that your parents object has to be offset by the distance of the child to the parent wich is the local position, which has to be rotated in relation to the parent object which can be done by multiplying with the localRotation. Perhaps you have to invert the rotation, i amnot sure about that one.
Your answer

Follow this Question
Related Questions
Need the localPosition equivalent of this script 2 Answers
Having Trouble with Texture Tiling and offset values. Very specific case. 2 Answers
A Perfect Question for Bunny83 hehehe 0 Answers
Unity Position Error? 1 Answer
Unity thinks that 14 = 15? 1 Answer