Obi Official Forum
Obi Rope for VR - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Obi Rope for VR (/thread-3617.html)



Obi Rope for VR - Holty - 15-10-2022

Hi. I want to create a short and interactable hose for a VR interactable fire extinguisher. The hoses on extinguishers are usually fairly stiff and no twisting or major bending should take place if possible. My questions are: are there issues with teleporting with obi rope parented to an object and held by the  VR player avatar? Can I restrict the amount of bend that the user can achieve while pointing / directing the nozzle so as to create a more realistic, thick rubber hose feel? Just want to check before purchasing. Many thanks.  

Sonrisa


RE: Obi Rope for VR - josemendez - 17-10-2022

(15-10-2022, 07:03 AM)Holty Wrote: are there issues with teleporting with obi rope parented to an object and held by the  VR player avatar?

Hi!

Teleporting and parenting don't work well together with physics, regardless of the physics engine you use. This is game physics 101:

https://answers.unity.com/questions/62497/-you-should-never-have-a-parent-and-child-rigidbod.html
https://digitalopus.ca/site/using-rigid-bodies-in-unity-everything-that-is-not-in-the-manual/
https://www.reddit.com/r/Unity3D/comments/97mge2/unity3d_question_about_teleporting_a_physicsy/

The reason is both operations work on the position and orientation of objects, but completely ignore dynamic properties (linear and angular velocities).

Parenting a dynamic object doesn't make sense, instead you want to constrain it. In Unity this is done using joints, the equivalent thing in Obi is attachments.

For teleporting a dynamic object, you usually need to call a specific method on it instead of just doing transform.position = something. For Unity rigidbodies, you call rigidbody.MovePosition(). For Obi actors, you call actor.Teleport(), or set the position/velocity of individual particles using the particles API.

So the answer is yes, you can do this in Obi as long as you implement it properly. Ignoring the fact that "regular" parenting and teleporting don't make sense for dynamic objects will yield completely incorrect results.

(15-10-2022, 07:03 AM)Holty Wrote: Can I restrict the amount of bend that the user can achieve while pointing / directing the nozzle so as to create a more realistic, thick rubber hose feel?

Yes, this is entirely possible. You have full control over stretching/bending/twisting compliance in Obi. Of course, the character's VR hand must be a dynamic object (rigidbody) as well, otherwise the rope can't apply forces to it (because it has no velocity property to modify) and restrict movement as a result of the rope being too stretched/bent/twisted.

let me know if I can be of further help, cheers!


RE: Obi Rope for VR - DulcetTone - 26-10-2022

(17-10-2022, 07:47 AM)josemendez Wrote: Hi!

Teleporting and parenting don't work well together with physics, regardless of the physics engine you use. This is game physics 101:


This answer puzzles me.

Is it not the case that physics are being calculated by extrapolating motion between the present position and previously stored positions?  If so, can't any a "broken" teleport system be fixed by tweaking the positions in the stored state data to render the teleport invisible to the physics code?

I appreciate, of course, that access to these store states may be difficult if they are maintained by native Unity objects that fail to offer a suitable interface to tweak the bits.  Is this the impediment?

tone


RE: Obi Rope for VR - josemendez - 26-10-2022

(26-10-2022, 01:49 PM)DulcetTone Wrote: This answer puzzles me.
Is it not the case that physics are being calculated by extrapolating motion between the present position and previously stored positions? 

What I mean is that naively "teleporting" a physics object -that is, setting its transform position directly- will not work the expected way, regardless of which paradigm your engine uses (position or velocity based). There's usually specific API methods that take care of modifying the internal physics state in a way that's consistent with teleportation.

In a position-based engine, a new velocity will be calculated as (positionIveBeenTeleportedTo - myPreviousPosition) / deltaTime, which will add spurious acceleration to the object. If you move the object far enough from its previous position, the resulting acceleration can be huge. The solution to this is of course to modify both the actual and the previous position.

(26-10-2022, 01:49 PM)DulcetTone Wrote: If so, can't any a "broken" teleport system be fixed by tweaking the positions in the stored state data to render the teleport invisible to the physics code?

Yes, that's exactly what ObiActor.Teleport() does. Quoting my previous post:

Quote:For teleporting a dynamic object, you usually need to call a specific method on it instead of just doing transform.position = something. [...] For Obi actors, you call actor.Teleport(), or set the position/velocity of individual particles using the particles API.