Obi Official Forum
Help Disabling Particle and obi collisions in run time. - 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: Help Disabling Particle and obi collisions in run time. (/thread-495.html)



Disabling Particle and obi collisions in run time. - Gieve - 19-03-2018

I was wondering what function I would need to call, or how to command the solver to disable collisions on obi ropes from both each other and obi colliders in runtime.

EDIT: To clarify, I would like to know of a reliable method to have the collision of the obi components toggleable as an option, I have tried disabling the obiSolver's ParticleCollisionConstraintParameters and CollisionConstraintPeramiters, but the simulation still renders the collisions.


RE: Disabling Particle and obi collisions in run time. - josemendez - 20-03-2018

(19-03-2018, 11:03 PM)Gieve Wrote: I was wondering what function I would need to call, or how to command the solver to disable collisions on obi ropes from both each other and obi colliders in runtime.

It depends on what level of granularity you need. If you just want to disable all interactions with all rigidbodies and ropes, you can disable particle collisions and regular collisions globally in the solver:

Code:
solver.particleCollisionConstraintParameters.enabled = false;
solver.collisionConstraintParameters.enabled = false;
solver.UpdateParameters();

You could also simply move the colliders you want to skip collisions with to a different layer that's not marked as a collision layer in the solver, or set their phase to be the same as the rope's.

Code:
obiCollider.phase = 1 //assuming your rope particles have a phase value of 1 too.



RE: Disabling Particle and obi collisions in run time. - Gieve - 20-03-2018

(20-03-2018, 09:50 AM)josemendez Wrote: It depends on what level of granularity you need. If you just want to disable all interactions with all rigidbodies and ropes, you can disable particle collisions and regular collisions globally in the solver:

Code:
solver.particleCollisionConstraintParameters.enabled = false;
solver.collisionConstraintParameters.enabled = false;
solver.UpdateParameters();

You could also simply move the colliders you want to skip collisions with to a different layer that's not marked as a collision layer in the solver, or set their phase to be the same as the rope's.

Code:
obiCollider.phase = 1 //assuming your rope particles have a phase value of 1 too.

Interesting, as that is what I had in my code word for word, and yet it visibly disables the components in the solver inspector but the collisions continue regardless.

EDIT: To give you the full scope of what I am striving to achieve, I have a UI toggle that sets a bool for if the collisions should be set or not in the ropes generator, I set the parameters for the rope and set the obisolver collisions to reflect the value that was altered by the ui toggle.

The ropes only use the collision parameters at the time of starting the game, although when the parameters are set by the generation code the solvers inspector changes but the collisions only act depending on the solvers components state at first run.

I am using solver.updateParameters() but the parameters are not updating correctly.


RE: Disabling Particle and obi collisions in run time. - josemendez - 20-03-2018

(20-03-2018, 09:55 AM)Gieve Wrote: Interesting, as that is what I had in my code word for word, and yet it visibly disables the components in the solver inspector but the collisions continue regardless.

EDIT: To give you the full scope of what I am striving to achieve, I have a UI toggle that sets a bool for if the collisions should be set or not in the ropes generator, I set the parameters for the rope and set the obisolver collisions to reflect the value that was altered by the ui toggle.

The ropes only use the collision parameters at the time of starting the game, although when the parameters are set by the generation code the solvers inspector changes but the collisions only act depending on the solvers components state at first run.

I am using solver.updateParameters() but the parameters are not updating correctly.

Hi there,

This exact code I posted works fine for me in 3.2, 3.3 and 3.3.1. Can you post yours?


RE: Disabling Particle and obi collisions in run time. - Gieve - 21-03-2018

(20-03-2018, 11:45 AM)josemendez Wrote: Hi there,

This exact code I posted works fine for me in 3.2, 3.3 and 3.3.1. Can you post yours?

Sorry I an unable to post my code as I'm away from my PC for a while, I ended up setting the phase for each rope to the same value if the bool was set to false.
Worked good enough.

I am using the latest 2017 build of unity if it matters at all.
I will send the code when I can.