Camera follow using Rigidbody2D brakes on platform

Hello,

I am using a simple script to do the camera follow, to achieve the smoothness I want, I do the camera movement based on the Rigidbody2D of the player.

// omitting parts
// float speed = 3f;
// float moveSpeed = rb.velocity.magnitude > speed ? rb.velocity.magnitude : speed;

The problem is, when the player is in a movement platform, I need to make the player children of the platform for him moves according to the platform. So no force is added to the Rigidbody2D then the camera does not
move. Any tips?

Thanks is advance,
Hudson Schumaker

Hi @Schumaker , maybe you could store the previous world position in your script and calculate the velocity based on current world position of your object

var currentVelocity = (currentWorldPosition - previousWorldPosition) / Time.deltaTime

Have you tried using Cinemachine? It supports 2D orthographic cameras, it’s very flexible and allows you to work in a more procedural way

thanks for the help. I will check it out. I have to say using the Rigidbody2D speed I achieve a very smooth camera.