- Home /
Unity hinge joint jitter when target gameObject parent is moving
I have a player car game object that moves forward with the following script:
float step = speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, targetPosition, step);
Inside this game object I have a child called Body and inside it another child called Neck Joint.
I would like to make a Bobble Head attached to my car object, more specifically to the Neck Joint. I have attached a head object with a hinge joint that works very well when the car is steering left/right (or rather when I swing the Body's local position left/right). The hinge joint's axis is in the z-direction and it has a spring setting.
My problem is when I move the parent player object with the above formula, the head seems extremely jittery in the z-axis. The left right swing works fine as per the hinge joint axis, but when my movement is in the direction of the hinge joint axis, I get really weird jitter as though the hinge joint is trying to catch up to the object.
I tried setting the physics iteration count to 100 and still the same issue.
Sorry if I am not clear, ask away if you didn't understand anything. And thanks for the help!
Answer by barbe63 · Jun 04, 2015 at 07:46 PM
First you should try to move the rigidbody instead of the transform in a FixedUpdate. Then maybe try to tweak the hinge swings limit.http://docs.unity3d.com/Manual/class-CharacterJoint.html
I am trying to keep with the transform movement. I the movement is restricted on a track and I found this to work best by playing with the transform ins$$anonymous$$d. I was unable to get it to work with RB
Your answer
Follow this Question
Related Questions
Hinge Joints Twisting around Wrong Axis 0 Answers
hing joint issue,Hing Joint Issue in tow truck 0 Answers
my enemy passes through the walls in unity ? 0 Answers
A position locked hinge joint with drag and no gravity? 1 Answer
Collision Not Working 1 Answer