Transform.position returning innacurate vector3 for animated objects
Hey, this is probably a really simple fix, but I've been banging my head against a wall for a few days now.
I have a tree of game-objects that make up a Robot 3d model. They are placed inside a root game-object as a container.
I have applied animations to several of the objects within the robot tree / hierarchy.
In code, within an update function of a separate gameobject, I am trying to create a lineRenderer to place a line that starts from itself, and ends on part of the animated robot.
This all works fine when the robot animation is removed, but as soon as it plays, the position is around 2m wrong on all 3 axis, and seems to be rotated through 2-3 axis also. E.g. instead of the line endpoint moving down and to the left, with the animated robot gripper, the line moves up, backwards and to the right.
I've checked the line renderer local vs world space, and several other checks. It seems that that transform.position of the animated child object of the robot is returning an incorrect vector3 position value.
Many thanks in advance for your help. :)
Del
Your answer
![](https://koobas.hobune.stream/wayback/20220613032702im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Animator Position VS Script Vector 3 0 Answers
Varying behaviour of transform.position.localPosition.x in StateMachineBehaviour OnStateUpdate 0 Answers
Proplem in move 3D AR object from point to point at run time 0 Answers
applying walk / run animation using anim.SetBool 1 Answer
Animation won't play just once and hold 0 Answers