17-05-2018, 09:05 AM
(This post was last modified: 17-05-2018, 09:07 AM by josemendez.)
(16-05-2018, 05:43 PM)VirtualCucumber Wrote: It sill falls behind
This is what I have:
Code://Solver declaration, assigned through editor
public ObiSolver solver;
public void Start()
{
solver.OnStepBegin += Move;
}
public void Move(object sender, EventArgs e)
{
//Movement
}
Just double checked your movement code. It seems that you're moving things around by setting the velocity of a rigidbody, instead of the position of a transform. This velocity is added to the rigidbody during FixedUpdate, at which point the rope has already been simulated, introducing a 1-frame delay.
Simply apply the velocity to the transform yourself. You don't even need a rigidbody (you're not using it at all). Do this:
Code:
transform.position += velocity * Time.fixedDeltaTime;
instead of
Code:
rb.velocity = velocity;