Obi Official Forum
thicknesses in 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 Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: thicknesses in runtime (/thread-2139.html)



thicknesses in runtime - Urbem - 03-04-2020

I want to change rope thikness in runtime. Like this:
path.thicknesses.data[_index] = 5f;

but in the game the rope is not updated. I try Update this functions, without result:
Rope.UpdateParticleProperties();
ropeMeshRenderer.UpdateRenderer(Rope);
solver.UpdateParameters();

How I can update Rope thicknesses in runtime?


RE: thicknesses in runtime - josemendez - 03-04-2020

(03-04-2020, 08:00 AM)Urbem Wrote: I want to change rope thikness in runtime. Like this:
path.thicknesses.data[_index] = 5f;

but in the game the rope is not updated. I try Update this functions, without result:
Rope.UpdateParticleProperties();
ropeMeshRenderer.UpdateRenderer(Rope);
solver.UpdateParameters();

How I can update Rope thicknesses in runtime?

Blueprints are assets (http://obi.virtualmethodstudio.com/tutorials/bigpicture.html). They're stored in disk, and instantiated into the scene at start. So changing them at runtime does not do anything - unless you copy their data to the runtime particle representation, or use them to instantiate new actors.

In runtime, you must work with particles directly. To change the radius of a particle:

Code:
// solver index of the first particle in the rope.
int solverIndex = actor.solverIndices[0];

// set all 3 principal radii to the same value:
solver.principalRadii[solverIndex] = new Vector3(radius);

For more info, see:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html