How could I go about getting the difference in angle and position between two CFrames?

This is a very specific use case - but essentially, I’m trying to do interpolation from the camera to the player. The reason I’m not just lerping, is because if the player is moving very fast (which in this game, they likely will be) the camera will lag behind the player for a moment or two. I want, once the interpolation starts, the camera to take any new movement the player does instantly, and only interpolate the difference that there was when the interpolation started.

I’m wanting to do something along the lines of this

local difference = --math here (Cam.CFrame * player.CFrame:Inverse() is what I tried, no idea what to do here really)

for i = 1,10 do
difference:Lerp(CFrame.new(),0.1)
Cam.CFrame = player.CFrame * difference
wait()
end

If anyone understands what I’m getting at and could help point me in the right direction, that would be very appreciated ^.^

2 Likes

Eureka! :stuck_out_tongue:

local difference = Camera.CFrame:ToObjectSpace(player.CFrame):Inverse()

for i = 1,10 do
difference:Lerp(CFrame.new(),0.1)
Cam.CFrame = player.CFrame * difference
wait()
end
2 Likes