Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to damp the swing in the Freight Lifter scenario?
#5
(23-01-2023, 05:38 PM)hariedo Wrote: As for the Rigidbody drag, that would make sway worse on the start of crane motion.  I am kinda looking for the best way to fake/cheese the simulation to reduce sway deflection on start AND end of a crane motion.  Artificially adding a little movement to the platform when the top of the crane moves, so they stay more in sync vertically, rather than having the platform "catch up" and then overshoot.  I don't want to completely fake it by kinematically moving the platform in unison with the crane and letting the pinned ropes just wiggle, but I might have to do that.

Yes, drag basically tries to get a rigidbody to stop moving so when you start moving the crane, the rigidbody would not start moving right away and this would increase the initial swing.

Probably the simplest, most controllable way to achieve what you want is to calculate the crane's acceleration and then apply a percentage of that acceleration to the load.

Pseudocode for calculating acceleration:

Code:
Vector3 oldPos;
Vector3 oldVel;
Vector3 accel;
float percentage = 0.5f;

Update()
{
Vector3 vel = (crane.transform.position - oldPos) / Time.deltaTime;
accel = (vel - oldVel) / Time.deltaTime;
oldPos = crane.transform.position;
oldVel = vel;
}

FixedUpdate()
{
load.velocity += accel * Time.fixedDeltaTime * percentage;
}
Reply


Messages In This Thread
RE: How to damp the swing in the Freight Lifter scenario? - by josemendez - 24-01-2023, 08:46 AM