Hello, I am having some trouble with CFrames. I want to rotate the CFrame then when I move the CFrame I don’t want the rotation to go away.
In my code I do this:
-- In this part, I am rotating the model.
local modelCFrame = part:GetPrimaryPartCFrame()
part:SetPrimaryPartCFrame(modelCFrame * CFrame.Angles(0,math.rad(90), 0))
task.wait(0.1)
-- in this part I move the model. The only issue is when I move the model, It resets the rotation.
model:SetPrimaryPartCFrame(Vector3.new(0,0,0))
they are both the same thing. bassically this code is just crafted togeather to simulate a much easier to understand version of my actual issue. If you are able to fix this though it would supply a solution to the same more complex version
If they are the same thing:
CFrame are a combination of both the position of an object and it’s rotation. When you try setting the cframe to Vector3.new(0, 0, 0), it sets it to a position of 0, 0, 0 with no rotation.
If you want to keep rotation, do
It’s the same as the “orientation” property when you’re applying it to a new cframe without any previous angle. It’s in radians instead of degrees, though, so instead of doing