29-03-2020, 07:12 PM
(This post was last modified: 29-03-2020, 07:15 PM by josemendez.)
(29-03-2020, 07:04 PM)slugGoddess Wrote: 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);
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 !
Particle positions (and velocities, radii, ... all particle properties) are expressed in solver space. So if you pass a solver space position to Gizmos.Draw() (which by default expects data to be expressed in world space), the drawn position and the actual particle position won't match at all. You must express the position in world space before drawing it, or set Gizmos.matrix accordingly. See: https://docs.unity3d.com/ScriptReference...atrix.html
Setting particle positions in FixedUpdate() works just fine for me. Can you share your code?