Obi Official Forum

Full Version: Rope position delay from parent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(16-05-2018, 05:17 PM)josemendez Wrote: [ -> ]Yes, you can just have that. I meant that the arguments of your Move() function should be the same ones declared for OnStepBegin, but I see you already did that.

It sill falls behind Triste

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
    }
(16-05-2018, 05:43 PM)VirtualCucumber Wrote: [ -> ]It sill falls behind Triste

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;
(17-05-2018, 09:05 AM)josemendez Wrote: [ -> ]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;

Yeah that's why I was going Translate it instead but due to the simplicity of the project, why not simple code as well Lengua

Anyway, thanks for the support. Asset is already 5 stars for its flexibility (puns) and now with its awesome support. Looking forward to getting cloth  Gran sonrisa
Pages: 1 2