Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How do I set a particle position at runtime ?
#3
(29-03-2020, 06:13 PM)josemendez Wrote: Particles are completely independent from each other. Setting the position of one particle won't automatically move other particles, nor make the rest of the rope "follow" it. If you want the entire rope to move to a different place, you need to iterate over all of its particles, and set their position.

Never use Update for physics (at least, not unless you know exactly what you are doing and why). All physics-related code should go in FixedUpdate.

Do you mean 40 different blueprints? If you need 40 completely different ropes, then yes, you need a blueprint for each one. The advantage of blueprints is that they can be shared by multiple ropes, saving a lot of memory.

Hey Jose ! 
Thanks a lot for answering so quickly. 


I tried setting the position in FixedUpdate instead, but sadly, the particle just goes straight back to its initial position with each new frame.
I have drawn a gizmo on the position it was supposed to move to (the bottom one), and one at the position it's actually at: 

Code:
Gizmos.DrawSphere(this.rope.solver.positions[solverIndex], 0.1f);

Gizmos.DrawSphere(position, 0.1f);
[Image: screenshot043.jpg]
As you can see they don't quite match.

I feel like there is something I am missing. Am I supposed to push the modified data to the solver or anything similar?
Thank you in advance !  Sonrojado
Reply


Messages In This Thread
RE: How do I set a particle position at runtime ? - by slugGoddess - 29-03-2020, 07:04 PM