Using a CFrame as a velocity for CFrame operations, help with multiplication

[All code in question are on the client]

So, basically what I am trying to achieve is using a CFrame for velocity instead of the classical Vector3 that you would use. I am doing this since I also need a velocity for rotation and CFrame contains both position and orientation

The problem I have stumbled upon is that I don’t know how to “lower the magnitude” of the CFrame. When using Vector3’s I just do Vector3.new(x,y,z) * 0.1 and it is 10 times smaller than originally. This does however not work on CFrames, it just throws an error. Multiplying 2 cframes also just “adds” them together.

I have tried using CFrame.new():Lerp(currentVelocityCFrame, deltaTime) but this gives unwanted results for some reason.

Currently I just multiply the part where velocity is added with 1/240 (since I have 240 fps), but this would not work on laggy computers or just lower framerates overall.

What I am looking for is a way to make CFrame velocities work on all clients, any help would be really appreciated since I have been stuck on this for quite some time now! :slight_smile:

After further testing I have concluded that I made a mistake in the calculations. It turns out that it doesn’t matter if you set the angle of a CFrame to something above Pi (I think) it just becomes Pi. This lead to the :Lerp() method behaving strangely. I have fixed this now and will mark this as the solution

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.