Unity-Technologies / URDF-Importer

URDF importer
Apache License 2.0
217 stars 71 forks source link

Imported Robot gameobject not respecting transform modifications via script #167

Closed vikas-shah closed 2 years ago

vikas-shah commented 2 years ago

Describe the bug When a robot is imported using its URDF file, and that robot gameobject is loaded from Unity script it always loads at position 0,0,0 and rotation 0,0,0. Any changes to these never takes effect. However, changes to scale are seen as expected.

To Reproduce Steps to reproduce the behavior:

  1. Checkout the code from my github repo
  2. The system version I'm using is: Unity Hub: 2.4.5 Unity Install: 2020.3.24f1 Ubuntu 20.04 Mono 6.12.0.122 Urdf Importer 0.5.0-preview
  3. Run the project in Game mode and verify that the arm prefab is loaded
  4. Try changing the transform values for position or rotation - there would be no impact
  5. Try changing the scale value and arm dimension will change

Console logs / stack traces No logs / stack traces

Expected behavior The way scale value changes are reflected in prefab, even position / rotation value changes should reflect changes in the scene in game mode

Screenshots None, as the code should show live demo

Environment (please complete the following information, where applicable):

Additional context Feel free to raise a PR on github if you reckon I'm doing something wrong.

hyounesy commented 2 years ago

URDF importer creates articulation bodies for robot joints and the transformation for articulation bodies is handled by the physics engine, so changing the Transform values in the Unity editor will not have an effect. You can however change the position of the root of the robot using TeleportRoot: https://docs.unity3d.com/2020.1/Documentation/ScriptReference/ArticulationBody.TeleportRoot.html