I’m trying to make this wedge rotate/change orientation specific to world axis, so when I do rotateY it will rotate the orientation on the y axis, but for some reason my script is rotating it super weirdly so if i rotate with RotateX, when I rotate with Y and Z it will change a different orientation axis than Y and Z(I don’t want this to happen)
video for reference
very bad image for reference
you can see that after I do rotate X, when i do RotateY again it changes a completely different orientation value than the Y one.
this is the code segment that moves and rotates the object to follow the mouse
local cframe = CFrame.New
local angles = CFrame.fromEulerAnglesFromXYZ
object:PivotTo(object.CFrame:Lerp(cframe(posX, posY, posZ)*angles(math.rad(rotationX), math.rad(rotationY), math.rad(rotationZ)), speed))
this is the code that changes the rotation when you press your rotate key
local rotationStep = 90
local rotationY = 0 --pressing r
local rotationZ = 0 --pressing t
local rotationX = 0 --pressing y
local function rotate(actionName, inputState, inputObj)
if inputState ~= Enum.UserInputState.Begin then return end
print(actionName)
if actionName == "RotateY" then
rotationY += rotationStep
elseif actionName == "RotateZ" then
rotationZ += rotationStep
elseif actionName == "RotateX" then
rotationX += rotationStep
end
end
theres a ton more in the actual script i didnt put, and i merged in a few parts that arent in that part of the script simply for convenience, if you dont think i gave enough information feel free to ask.