30-06-2023, 09:13 PM
(29-06-2023, 06:23 AM)josemendez Wrote: Hi!
So this is more a question about physics and rigidbodies in general than it is about Obi.
The Rigidbody component in Unity endows an object with physical properties (velocity, mass, etc) and drives it using physics. Attaching a rope to a rigidbody using a dynamic attachment enables two-way coupling between them, that is: the rope is able to apply forces to the rigidbody, and the rigidbody is in turn able to apply forces to the rope.
So as long as your player is moved around in a physically consistent way it should all just work. By "physically consistent" I mean modifying its velocity somehow, for instance by adding forces or impulses. If you set its transform position directly, you're entirely bypassing physics simulation and as a result the player will ignore any forces applied by the rope allowing him to stretch the rope indefinitely.
I'm fairly sure that Unity's built-in XR locomotion uses no physics/rigidbodies but a CharacterController, so it will ignore physics entirely: https://docs.unity3d.com/Packages/com.un...based.html
https://www.youtube.com/watch?v=4WiMogkep1U
As stated in Unity's manual:
https://docs.unity3d.com/ScriptReference...oller.html
If that's the case, you'll need to find a physics-based locomotion method that can be affected by forces. This is necessary not just for rope interaction, but to allow the player to be affected by any external forces other than just static collision geometry.
kind regards,
Thank you so much for replying so quickly!
This makes sense.
Yesterday I made changes to the 'player' to make it be fully physics based as only the hands were using physics previously (I used https://www.youtube.com/watch?v=gk0EBIe6ZN8 as a tutorial) and it mostly works now! The rope doesn't stretch when I pull it far, and the hand is 'pulled' back by the rope, truly stays attached to the particle it grabbed.
I need to make some tweaks next (e.g. hand positioning relative to the rope after grabbing doesn't look good yet), I will try to improve things and let you know if I have more questions.
Thanks for the help!