Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Instantiate, HingeJoint physics wrong

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

  1. PatrickKa

    PatrickKa

    Joined:
    Apr 30, 2014
    Posts:
    253
    Hey,

    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