Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope position delay from parent
#11
(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
    }
Reply
#12
(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;
Reply
#13
(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
Reply