Needing help with CFrames

I’m currently working on a small game that has a third person camera that the player cant rotate, instead being moved when the player reachs a checkpoint, currently the rotation is being done with orientation and when the value goes from lets say -179 to +180 it does a full spin in the opposite direction instead of just moving the 1 degree smoothly (see video)


Essentially in the video im going from -90 (270) degrees to 130

I would like a way to keep using the orientation style rotation values but be put to a CFrame where the angles can be above 180

    subject.Orientation = subject.Orientation:Lerp(Vector3.new(X.Value,Y.Value,Z.Value),1/Weight.Value)
	cam.CameraType = Enum.CameraType.Scriptable
	cam.CFrame = subject.CFrame
3 Likes

Lerp using CFrame instead of Orientation.

subject.CFrame = subject.CFrame:Lerp(CFrame.Angles(math.rad(X.Value), math.rad(Y.Value), math.rad(Z.Value)) + subject.Position, (1 / Weight.Value))

Im having this problem with CFrame.Angles


How would i make the orientation values just be easilly put into the cframe.angles to produce the same result?

1 Like

There seems to be a problem with the code. That is not how it should rotate. Could you send me your current code.

Go into an empty Baseplate, paste the following code into the command bar. Enter whatever Orientation you want inside of the math.rad and observe the orientation of the spawnpoint change in properties, it (seems to be) working without issues. If you find an issue then let me know.

workspace.SpawnLocation.CFrame = workspace.SpawnLocation.CFrame:Lerp(CFrame.Angles(math.rad(50), math.rad(0), math.rad(50)), 0.05)

(After pasting the code, press and hold the enter key to rotate the spawnpoint.)

subject.CFrame = subject.CFrame:Lerp(CFrame.Angles(math.rad(X.Value), math.rad(Y.Value), math.rad(Z.Value)) + subject.Position, (1 / Weight.Value))

im just using what you sent.

Ok ive reached the behaviour i was looking for, the solution was to use CFrame.fromOrientation(), i used it before but didnt know i had to use math.rad()

CFrame.fromOrientation takes values in Radians.

yeah and using math.rad() it worked

math.rad takes a value in Degrees and returns a value in Radians.

off topic but this is actually really cool LOL, i love it

1 Like