microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

[ObjectManipulator]Runtime physics not working after remove and add again a rigidbody #10347

Closed Kent1LG closed 9 months ago

Kent1LG commented 2 years ago

Describe the bug

Hi everyone. I'm currently trying to allow userto enable or disable the objects collision in runtime. As far as the Rigidbody can't be disable, I tried to removed it and add it again in order to disable then enable the physics. In this situation (which is the same manually or by script), when I removed Rigidbody from the object, it lost is collision behaviour (this is what I want), then when I add it again the object is still passing through other object instead of getting back is collision behaviour.

To reproduce

Steps to reproduce the behavior:

  1. Create two cubes with an ObjectManipulator and Rigidbody (Kinematic on)
  2. Play the scene
  3. Make them collide
  4. Remove both Rigidbody
  5. Make them collide (they will pass through)
  6. Add back both a Rigidbody (Kinematic on)
  7. Make them collide

Expected behavior

The Physic and collideable behaviour should get back when adding a Rigidbody in runtime.

Your setup (please complete the following information)

Target platform (please complete the following information)

Additional context

It seems like the Unity Project settings/Physics/Layer Collision Matrix doesn't matter in any way in this situation.

david-c-kline commented 2 years ago

@Kent1LG,

Can you give this a try on MRTK 2.7.2? It would be good to know if we handled this already :smile:

vogr commented 2 years ago

Hello, I actually encountered this issue today: as a workaround for anyone hitting this bug, it seems that removing and adding back the ObjectManipulator after adding the Rigibody makes the collisions work again.

Kent1LG commented 2 years ago

Hello,

Thank you @vogr for the extra information, very useful !

@davidkline-ms sorry for the late response, the update of the project wasn't easy. I tried and yes there is also the issue on MRTK 2.7.2 .

IssueSyncBot commented 9 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visithttps://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!