the question is formatted weird, but basically i have 3 cameras for my menu that do 360 rotations. i want them to look slightly down (like this)
without them looking up because i’m rotating them. it’s probably an easy solution lol
task.spawn(function()
while task.wait() do
cams.Cam1.CFrame *= CFrame.Angles(0, math.rad(0.5), 0)
end
end)
You may just need to set the Transform of the object to world. I don’t know how to script this off the top of my head, but you can do CTRL L (windows) or CMD L (mac) to change the transformation to world.
I will get on Studio in a little bit and see if I can solve it. I would check if you can change the Transform Coordinates of an object through a script if you can.
task.spawn(function()
while task.wait() do
local x,y,z = workspace.Camera.CFrame:ToOrientation()
cam.Cam1.CFrame = CFrame.new(cam.Cam1.CFrame.Position) * CFrame.Angles(x, math.rad(0.5), z)
end
end)
changed it to this because it was flipping upside down and it’s not rotating at all now?
task.spawn(function()
while task.wait() do
local x,y,z = workspace.Camera.CFrame:ToOrientation()
cams.Cam1.CFrame = CFrame.new(cams.Cam1.CFrame.Position) * CFrame.Angles(x, y, math.rad(0.5))
end
end)
local rotations = 0
task.spawn(function()
while task.wait() do
local x,y,z = workspace.Camera.CFrame:ToOrientation()
rotations += 1 % 360
cams.Cam1.CFrame = CFrame.new(cams.Cam1.CFrame.Position) * CFrame.Angles(x, y, math.rad(rotations))
end
end)
task.spawn(function()
while task.wait() do
local currentRotation = cams.Cam1.CFrame:ToEulerAnglesXYZ() -- Get the current rotation
local newY = currentRotation.Y + math.rad(0.5) -- Add rotation around the Y axis
cams.Cam1.CFrame *= CFrame.Angles(currentRotation.X, newY, currentRotation.Z) -- Apply the new rotation while keeping the current rotation on X and Z axes
end
end)
You might need to store the camera’s original CFrame in a variable before rotating it, like so:
local cam1CFrame = cams.Cam1.CFrame
task.spawn(function()
while true do
cams.Cam1.CFrame = cam1CFrame * CFrame.Angles(0, math.rad(0.5), 0)
task.wait()
end
end)
@bloodbonniekingnoob1 It could also be that you’ll need to update the camera’s Focus property:
local cam1CFrame = cams.Cam1.CFrame
task.spawn(function()
while true do
cams.Cam1.CFrame = cam1CFrame * CFrame.Angles(0, math.rad(0.5), 0)
cams.Cam1.Focus = cams.Cam1.CFrame
task.wait()
end
end)
@astraIboy their solution is getting close, im making a few changes based on my assumption of your implementation;
I will be assuming you want to rotate a part/camera/cframe around the Y axis whilst remaining facing down at a constant angle.
I will be assuming ur doing this manipulation on the client side and thus will be using RenderStepped.
-- Code should be ran in a LocalScript
local RunService = game:GetService("RunService")
local Part = workspace:WaitForChild("Part")
local ROT_SPEED = math.rad(45) --Rotation speed in radians per second (converted from degrees for your convenience)
local DOWN_ANGLE = math.rad(30) -- Constant angle at which the part is facing downwards
local TAU = 2 * math.pi
local rot = 0
RunService.RenderStepped:Connect(function(dt)
rot += ROT_SPEED * dt
rot = rot % TAU
Part.CFrame = CFrame.new(Part.Position) * CFrame.Angles(0, rot, DOWN_ANGLE)
end)
Sorry for the late reply, the streamable is no longer watchable so im not sure as to what the bug is, please verify that the CameraBindModule is being executed as expected tho seeing the other code should be correct.
Ah! looking back at my initial footage of the rotating part, it seems like you are assuming the logical Front face of the part, whereas the one I was intending to use would be the Left face, you could either fix this by offsetting again within the camera module, OR the in my opinion more sensible approach of using RotationOrder
On a 2nd note I did not get RotationOrder to work myself as quickly as I would like, I tested manually doing the two manipulations in order and that worked.
(I am again sorry for my late reply, I really do hope you were able to resolve it on your own, and if not I hope this resolves the last of your issues)