Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Instantiate, HingeJoint physics wrong

Discussion in 'Physics' started by PatrickKa, Dec 5, 2014.

  1. PatrickKa


    Apr 30, 2014

    I got a player that is completely physic based. You can add forces and control the player that way. To make it a little easier I want to show how the player would behave.

    That task is actually very simple. I set my player to kinematic = true and Instantiate it again. That way I achieve a copy. I set up another layer for the copy to avoid collisions.

    Now I set the kinematic of that copy to false.

    I think the velocity and all that stuff is not copied. Thats why I loop all objects and I set up the velocity, angularVelocity, mass, rotation and that stuff.

    Furtheremore I'm using HingeJoints, thats why I overwrite anchor, connectedAnchor and that stuff, too.

    I run that project and it looks alright but the physic is off sometimes. If I apply torque to the joints it gets even worse.

    I really don't understand. I suppose that I need to overwrite the velocity of the HingeJoint, too. But I cannot access it because it is read-only.

    Is there an alternative to Instantiate that does a real copy? How can I solve the problem?

    I'm really running out of ideas...

    Thank you