Obi Official Forum
Suggestion / Idea Scripting Electric Cable Force on Obi Rope - 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: Suggestion / Idea Scripting Electric Cable Force on Obi Rope (/thread-729.html)



Scripting Electric Cable Force on Obi Rope - phys_modeler - 25-10-2018

Hi everyone.  I am considering purchase of the remarkable Obi Rope to do some custom physical modeling in Unity, and wanted to ask a question.

Goal:  

Model the self-generated motion of a set of electrical cables, via Obi Rope

Ideas:

1.  I'd model a set of connected ropes, Obi via stitch constraints.

2.  Then I'd like to treat some of the ropes as "electric cables", in the sense that they will produce a scripted magnetic force on each other.

3.  I'd like to script the force in a C# method that iterates over each Obi particle in those "electric cables", to produce the mutually-induced net magnetic force on just those cables.

4.  When the net magnetic force is calculated, I add it to other forces, and model (1.) moves an increment under the net force.

5.  I loop the method of (3.) to see the evolution of the shape of the connected ropes over some timeframe.

6.  Changing "current":  I increase some Inspector property value to alter current in (3.), hence the force, to see how it changes the evolution of the shape.

Questions / Notes:

To perform method (3.), is it possible to set and get all Obi particle properties of model (1.) from within a C# script method?   Or is there a different way to add a custom physics force?

I don't need real-time performance; even something that updates rope positions once a minute would be ok.

--

Thanks for any thoughts.  If such custom physics sim is generally feasible, I'll purchase and just give it a shot.


RE: Scripting Electric Cable Force on Obi Rope - josemendez - 28-10-2018

(25-10-2018, 10:38 PM)phys_modeler Wrote: Hi everyone.  I am considering purchase of the remarkable Obi Rope to do some custom physical modeling in Unity, and wanted to ask a question.

Goal:  

Model the self-generated motion of a set of electrical cables, via Obi Rope

Ideas:

1.  I'd model a set of connected ropes, Obi via stitch constraints.

2.  Then I'd like to treat some of the ropes as "electric cables", in the sense that they will produce a scripted magnetic force on each other.

3.  I'd like to script the force in a C# method that iterates over each Obi particle in those "electric cables", to produce the mutually-induced net magnetic force on just those cables.

4.  When the net magnetic force is calculated, I add it to other forces, and model (1.) moves an increment under the net force.

5.  I loop the method of (3.) to see the evolution of the shape of the connected ropes over some timeframe.

6.  Changing "current":  I increase some Inspector property value to alter current in (3.), hence the force, to see how it changes the evolution of the shape.

Questions / Notes:

To perform method (3.), is it possible to set and get all Obi particle properties of model (1.) from within a C# script method?   Or is there a different way to add a custom physics force?

I don't need real-time performance; even something that updates rope positions once a minute would be ok.

--

Thanks for any thoughts.  If such custom physics sim is generally feasible, I'll purchase and just give it a shot.

HI there,

You can add custom external forces by either modifying particle velocities:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

Or, using the Oni.AddParticleExternalForces() function, which does it for you.
See the ObiExternalForceZone derived classes (ObiSphericalForceZone or ObiAmbientForceZone) for examples on how to use it.


RE: Scripting Electric Cable Force on Obi Rope - phys_modeler - 08-11-2018

(28-10-2018, 10:39 AM)josemendez Wrote: HI there,

You can add custom external forces by either modifying particle velocities:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

Or, using the Oni.AddParticleExternalForces() function, which does it for you.
See the ObiExternalForceZone derived classes (ObiSphericalForceZone or ObiAmbientForceZone) for examples on how to use it.

Thanks, Jose.  I'll check it out!