Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope position delay from parent
#5
(16-05-2018, 12:02 PM)josemendez Wrote: Use "After Fixed Update" as your simulation order, if the object is moved using animation.

If you're not using animation but procedural movement in Update(), do it in FixedUpdate() instead.

My movement is in FixedUpdate() 

Code:
public void FixedUpdate()
   {
       Move();
   }

private void Move()
   {
       targetVelocity = canMove ? input * moveSpeed : Vector2.zero;
       float targetXAccelerationTime = input.x == 0 ? decelerationTime : accelerationTime;
       float targetYAccelerationTime = input.y == 0 ? decelerationTime : accelerationTime;
       velocity.x = Mathf.SmoothDamp(velocity.x, targetVelocity.x, ref velocityXSmoothing, targetXAccelerationTime);
       velocity.y = Mathf.SmoothDamp(velocity.y, targetVelocity.y, ref velocityYSmoothing, targetYAccelerationTime);

       rb.velocity = velocity;
       transform.rotation = Quaternion.Euler(0, 0, velocity.x * torque);
   }

This is my movement, simply using Rigidbody velocity.

EDIT:
I could easily Translate the object instead, just wanted to keep it simple with a small project.
Reply


Messages In This Thread
RE: Rope position delay from parent - by cubrman - 15-05-2018, 08:02 PM
RE: Rope position delay from parent - by VirtualCucumber - 16-05-2018, 01:59 PM