Obi Official Forum
Help Rope position delay from parent - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Rope position delay from parent (/thread-600.html)

Pages: 1 2


RE: Rope position delay from parent - VirtualCucumber - 16-05-2018

(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
    }



RE: Rope position delay from parent - josemendez - 17-05-2018

(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;



RE: Rope position delay from parent - VirtualCucumber - 19-05-2018

(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