Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Joining two bodies together with fixedjoint in exact position.

Discussion in 'Physics' started by Mike_d3v, May 21, 2023.

  1. Mike_d3v


    Mar 23, 2023
    Hi, I have the following setup:
    ObjectA which is connected via configurable joint to ObjectB. (The conf. joint component is on A)
    I have objectC which i want to join to ObjectA, having it fixed at exact position and rotation relative to A (so kind of same as if i parented C under A but here i am using a fixed joint instead)
    So i set the A.tranform.position and A.rigidbody.position to be where i want it relative to C and then simply do A.addComponent<FixedJoint>()
    And set the connected body to C and the expected result would be that the two objects are now fixed at that exact position and rotation in relation to each other as if they were connected by metal bar.
    But the object A seems to attach always at a slightly different position.
    I tried both with the automatic anchor on and off, but doesn't seem to make difference. It might be because the configurable joint is affecting the objectA pulling it out of position or something? Since i am setting the pos and rot of the A transform and rigidbody manually and the configurable joint might not like that..?
    I am not super versed with joints, so i am not sure what i am doing wrong here.

    Last edited: May 21, 2023