Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
thicknesses in runtime
#1
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?
Reply
#2
(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
Reply