[SOLVED] How do I make a viewmodel follow the camera smoothly, rather than being completely attached to it?

I’m working on a FPS game, and I want to have the viewmodel (player’s hand, and the gun) move to the player’s position smoothly with a lerp function, however, I’m not too sure how to do this, as the only way I’ve figured out to have the viewmodel follow the player is by parenting it to the camera, which does make it move with the camera, however, not smoothly, and not adjustable. Any other way to do this?

Hey @The_J,

Have you looked into the math functions? They have lerp and lerpAngle which you could use. You could try to have an empty entity parented to the camera, just to reference its position. Then, on a separate entity with your viewmodel you could have a script that simply math.lerps to the empty entity’s position.

This way you should have considerably more control over how the viewmodel moves.

If you want some further reference, this thread may be a good read. While it is a discussion on how to smoothly move the camera, the same applies to your viewmodel.

This worked perfectly, thank you!

1 Like