Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How do I set a particle position at runtime ?
#10
Hi Jose, 

So your advice worked, especially the one with the solver being a parent of the scalp and moving the translation gizmo to the beginning of my rope. This helped a lot.
Everything is working and I can set the ropes in place programmatically  Sonrisa

However, at some point, I'm going to need to restore the particle positions I am serializing and storing for later use.
Updating them in FixedUpdate doesn't work for me. They just go back to their normal position when Update runs.
I tried setting them in world position with transform.TransformPoint (correct me if that's not the right way to do this), I tried with the solver positions, using Vector3, Vector4...

What I am doing is : 

Code:
void FixedUpdate() {

 this.rope.solver.positions[this.rope.solverIndices[solverIndex]] = new Vector3(0f, 0f, 0f);

 Debug.Log(this.rope.solver.positions[this.rope.solverIndices[solverIndex]]);

}

void Update() {
   Debug.Log(this.rope.solver.positions[this.rope.solverIndices[solverIndex]]);
}

But the Debug.Log in FixedUpdate() prints : 0, 0, 0, 0
and the one in Update() prints :  0.1, 7.1, -0.3, 0.0

Basically, it just always goes back to its normal position after I set it in FixedUpdate().
Am I doing something wrong ? 
Is there a way to force those particle into place, and then, allow the simulation to run as normal ?

I've read quite a bit about direct interaction with Oni, but all the examples I found no longer seem to work with my current version of ObiRope, for exemple : 


Code:
pos[0] = l2sTransform.MultiplyPoint3x4(this.start);
Oni.SetParticlePositions(this.solver.OniSolver, pos,1, this.rope.solverIndices[solverIndex]);
   

So sorry this issue is taking so much of your time  Triste
I am very grateful for your help.
Reply


Messages In This Thread
RE: How do I set a particle position at runtime ? - by slugGoddess - 02-04-2020, 11:33 AM