Obi Official Forum

Full Version: thicknesses in runtime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
(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/tutor...cture.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/tutor...icles.html