12-04-2019, 10:10 PM
(12-04-2019, 07:10 AM)josemendez Wrote: Hi,
Delays are generally caused by updating things in the wrong order, for instance if your script changes the rigidbody position after simulation has taken place for that frame, there will be a 1-frame delay between the rope and your object.
Why not setting particle positions/velocities directly to control the hands? See:
http://obi.virtualmethodstudio.com/tutor...icles.html
How naive of me not to check the docs for scripting particles
Code:
public virtual IEnumerator Interact(BalloonController balloon)
{
var previousMass = balloon.solver.invMasses[0];
while (Mathf.Abs(Vector3.Distance(transform.position, balloon.solver.positions[0])) > 0.1f)
{
balloon.solver.invMasses[0] = 0;
balloon.solver.positions[0] = Vector3.Lerp(balloon.solver.positions[0], transform.position, grabSmoothing * Time.deltaTime);
yield return new WaitForFixedUpdate();
}
balloon.solver.invMasses[0] = previousMass;
}
Runs very nice now, thank you for the fast reply