Tweening and rotating camera while still following player

I’m having a hard time trying to figure out how to tween the camera’s rotation and position, while still following the player like it does in normal gameplay. Think of it like the camera shifting to get a better view of something, like turning a corner and having the camera tween to give you a better view without you needing to do it yourself.

I can tween the camera itself pretty easily. The problem is, it doesn’t follow the player as it tweens, so by the time it gets to its destination, the player may have already walked off somewhere else. Even then, when the CameraType goes from Scriptable back to normal, the camera just snaps back to where it was before; my hope is that it would stay in the position it tweened to after switching the CameraType back to Custom.

I’ve tried a few things, like tweening the CameraOffset, but that makes rotating the camera yourself afterwards very odd, and the CameraOffset can only tween the position anyway.

Does anyone have any ideas? It would be a big help.

Try using CFrame:lerp() instead of tween service. This will allow you to maintain a constant offset from the player while allowing the angles to change.

[CFrame | Roblox Creator Documentation] (CFrame Docs)
[CFrame:lerp How to use it properly - #9 by Kacper](Example of lerp)

Insteaed of literally tweening the position and orientation, you need to tween the orientation, and maintain a constant position relative to the player.

3 Likes

Cool! I’ll have to play around with Lerp, but it sounds helpful. Thanks!