Trying to Move One Rigidbody in Sync With an Animated Rigidbody

I have a rigidbody platform that is being animated, and has animate physics enabled. This platform is animated to move down and up quickly like a spring. But the movement of the animation seems to be moving too quickly for the passenger rigidbody to stay connected to it, no matter what I do.

I’ve tried syncing the velocity of the passenger and platform through use of OnCollisionStay, which works if I slow the animation down. But at full speed the passenger still lifts off of the platform for a bit at the point where the platform starts to change direction. I’m sure there’s a physics based reason for this, but I expected that they would have moved completely in sync.

While yes by a physics standpoint springs tend to launch things away from them, I would like to apply the launch force manually to the passenger, I don’t want the actual animation to be the thing generating the launch force, but I do want the passenger to move along with it.

I ended up getting something close to what I was looking for. But I never actually managed to keep the passenger connected to the platform at all times, luckily I found a way that didn’t require that.

However, I did find a way to keep the passenger connected to the platform while it was descending quickly. In addition to syncing up the two velocities. I also used OverlapBox on the platform, the overlap checks for whether the passenger lost contact with the platform that frame, and if so it uses MovePosition on the passenger, moving it by the same amount as the platform that frame. This managed to make up for the bounciness while descending.

I still wasn’t able to keep the passenger from flying away after the quick ascension. Luckily I managed to get around this by having the manual launch trigger at the same time, cancelling it out.