Obi Official Forum
Any way to dynamically enable/disable a handle at runtime? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Any way to dynamically enable/disable a handle at runtime? (/thread-1259.html)



Any way to dynamically enable/disable a handle at runtime? - mikemonroe_oc - 03-07-2019

I have a Obi softbody ball (think water-balloon elasticity) that I want to be pulled and stretched (in VR) from two specific ends (top and bottom).
Right now I have top and bottom particles pinned and setup with Handles, which works exactly how I'd like it- except for I would like the ability to disable one of the Handles, based on the situation, and have those associated pinned particles with the Handle react normally as if they were not pinned.

So far I haven't had any luck with this at all, when disabling the Handle the associated particles just get left pinned to the last location the Handle was at.
What's the best approach to doing this?


RE: Any way to dynamically enable/disable a handle at runtime? - mikemonroe_oc - 07-07-2019

@josemendez?


RE: Any way to dynamically enable/disable a handle at runtime? - josemendez - 07-07-2019

(03-07-2019, 09:11 PM)mikemonroe_oc Wrote: I have a Obi softbody ball (think water-balloon elasticity) that I want to be pulled and stretched (in VR) from two specific ends (top and bottom).
Right now I have top and bottom particles pinned and setup with Handles, which works exactly how I'd like it- except for I would like the ability to disable one of the Handles, based on the situation, and have those associated pinned particles with the Handle react normally as if they were not pinned.

So far I haven't had any luck with this at all, when disabling the Handle the associated particles just get left pinned to the last location the Handle was at.
What's the best approach to doing this?

Hi there,

Disabling/enabling handles works fine for me. Make sure the particles in the handle were not fixed before adding them to a handle. If they were, deactivating the handle will return them to the state they had at the time of creating the handle (i.e., fixed), resulting in the behavior you describe.

kind regards,


RE: Any way to dynamically enable/disable a handle at runtime? - mikemonroe_oc - 08-07-2019

(07-07-2019, 09:13 PM)josemendez Wrote: Hi there,

Disabling/enabling handles works fine for me. Make sure the particles in the handle were not fixed before adding them to a handle. If they were, deactivating the handle will return them to the state they had at the time of creating the handle (i.e., fixed), resulting in the behavior you describe.

kind regards,

Oh, in that case I suspect I've found some sort of bug then? I assumed fixing the particles was required. I say that, because if I merely select a particle after Re-Initializing the softbody, and add a Handle, and then run, I receive a ton of these errors at runtime:


Code:
transform.position assign attempt for 'Cluster0' is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Transform:set_position(Vector3)
Obi.ObiSoftbodySkinner:UpdateBones(Object, EventArgs) (at Assets/Obi/Rendering/ObiSoftbodySkinner.cs:122)
Obi.ObiSolver:EndFrame(Single) (at Assets/Obi/Scripts/Solver/ObiSolver.cs:727)
Obi.ObiSolver:LateUpdate() (at Assets/Obi/Scripts/Solver/ObiSolver.cs:905)
Expanding invalid MinMaxAABB
Assertion failed on expression: 'IsFinite(outDistanceForSort)'

with Cluser# varying 


If I fix the particles that are attached to a hand,  this doesn't occur and it acts like I expected, however disabling the handle leaves the particles pinned where they were.

What should I do?

Edit: Using Unity 2018.2.5f1 and latest Obi Softbody from the Asset Store (just bought it 2 weeks ago) 4.1

I get the same error if I import Obi into a new empty project, and attempt to add a Handle to the existing Ball in the BallPool demo. So this definitely looks like a bug?


RE: Any way to dynamically enable/disable a handle at runtime? - mikemonroe_oc - 10-07-2019

@josemendez ?


RE: Any way to dynamically enable/disable a handle at runtime? - msw201089 - 10-09-2019

I am running into this exact same problem. No matter if I add the handle in the editor or in runtime, fix the particle before or after the handle is added, or adjust the mass and velocity in the solver or the actor and then push to solver, the mesh freaks out and does not behave as expected.

A solution to this, or an understanding of if this is an error produced by the soft body asset specifically would be great.


RE: Any way to dynamically enable/disable a handle at runtime? - mikemonroe_oc - 10-09-2019

There was a bug in ObiParticleHandle.cs. I PM'd you the codefix I received from VM via email.


RE: Any way to dynamically enable/disable a handle at runtime? - arrnav96 - 16-11-2020

(10-09-2019, 07:17 PM)mikemonroe_oc Wrote: There was a bug in ObiParticleHandle.cs. I PM'd you the codefix I received from VM via email.
Can you please PM me the fix too? Or @josemendez?


RE: Any way to dynamically enable/disable a handle at runtime? - josemendez - 16-11-2020

(16-11-2020, 01:00 AM)arrnav96 Wrote: Can you please PM me the fix too? Or @josemendez?

This was fixed a long time ago, the version on the store contains the fix.

Do you need this for any other older version?