Search Unity

Bug Unity Physics Rigid Joint bug swaps entity positions

Discussion in 'Physics for ECS' started by HPlumley, May 8, 2020.

  1. HPlumley

    HPlumley

    Joined:
    Oct 13, 2015
    Posts:
    6
    The RigidJoint or the CreateFixed joint has a bug in Unity Physics version 0.3.2

    The joint reverses the positions of the two entities when it is applied. You can see the process in the UnityPhysicsSamples - 4a. Joints Parade if you colour one of the two cubes a different colour.

    The expected behaviour of the joint can be obtained by changing the order of the Rigid Transforms in the Rigid Joint script.

    Causes incorrect behaviour:
    CreateJointEntity(
    JointData.CreateFixed(
    new RigidTransform(OrientationLocal, PositionLocal),
    new RigidTransform(OrientationInConnectedEntity, PositionInConnectedEntity)
    ),
    entityManager, conversionSystem
    );

    Causes expected behaviour:
    CreateJointEntity(
    JointData.CreateFixed(
    new RigidTransform(OrientationInConnectedEntity, PositionInConnectedEntity),
    new RigidTransform(OrientationLocal, PositionLocal)
    ),
    entityManager, conversionSystem
    );

    I'm not sure if the problem is just with the RigidJoint creator in the samples or if the problem runs deeper into the Unity Physics JointData.CreateFixed

    Tested with latest https://github.com/Unity-Technologies/EntityComponentSystemSamples
    and Unity 2019.3.10f1

    Edit mode:
    Annotation 2020-05-08 015520.jpg
    Frame 1:
    Annotation 2020-05-08 015539.jpg
    Frame 2:
    Annotation 2020-05-08 015551.jpg
    Frame 3:
    Annotation 2020-05-08 015605.jpg
     
    Nyanpas likes this.
  2. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    Thanks for reporting, we'll fix it in the next update
     
  3. HPlumley

    HPlumley

    Joined:
    Oct 13, 2015
    Posts:
    6
    Hi Adam,

    No problem, thanks for acknowledging.

    Is the bug in the Unity Physics JointData.CreateFixed or in the joint authoring scripts provided in the samples?

    Also approximately when do you expect the next update to be: days, weeks?
     
  4. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    I haven't had a chance to take a look to say where the actual bug is, because at face value nothing looks fishy. Expect the next update on the order of a few weeks rather than a few days.