I have no idea why I can’t seem totate the part back to his old rotation like this doesn’t work and I can;t find anything on the devforum, can somone please help me!?!
|||local xPosLastPlate = lastPlate.CFrame.Position.X|
|||local newXPosition = xPosLastPlate + 34|
|||local oldYPos = v.CFrame.Position.Y|
|||local oldZPos = v.CFrame.Position.Z|
|||local oldAngleX = v.CFrame.Orientation.X|
|||local oldAngleY = v.CFrame.Orientation.Y|
|||local oldAngleZ = v.CFrame.Orientation.Z|
|||v.CFrame = CFrame.new(newXPosition, oldYPos, oldZPos)|
|||v.CFrame = v.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(oldAngleX), math.rad(oldAngleY), math.rad(oldAngleZ))|
If you just want to revert it back to the original rotation then store the old cframe in a variable and set the new cframe to CFrame.new(currentCFrame.position) * oldCFrame.Angles for example:
local part = script.Parent
local oldCFrame = part.CFrame
-- Example new CFrame
local newCFrame = part.CFrame * CFrame.Angles(200, 200, 200)
part.CFrame = newCFrame
-- Sets new angles by multiplying a new cframe containing the position by the old rotation
part.CFrame = CFrame.new(part.CFrame.Position) * oldCFrame.Rotation
You could also apply the rotation in a different order using the 4th paramemter in fromEulerAngles.
Orientation and CFrame apply angles in different orders
just make a reference to your old orientation, basically what the other guy said.
also you should close your other topic, you have two topics that are the same.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.