What do you want to achieve?
Fix camera rotation issue, the camera tilts depending on where the player is moving it.
What solutions have you tried so far?
I have looked on the Devforum but funny enough - no one has the same issue.
RunService.RenderStepped:Connect(function(dt)
if dragging then
UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
local mouseDelta = UIS:GetMouseDelta()
current_mouse_pos_Y = mouseDelta * speed * dt
oldMousePos = current_mouse_pos_Y
--current_mouse_pos_Y.X*speed
CurrentCamera.CFrame *= CFrame.Angles(current_mouse_pos_Y.Y*speed,current_mouse_pos_Y.X,0):Inverse()
end
end)
Video: Uploading: Test Studio - Roblox Studio 2024-03-01 23-50-18.mp4…
1 Like
How4rdy
(wardi)
March 2, 2024, 12:38am
#4
it seems the video is not accessible can you edit the post, i want to see whats wrong
It doesn’t allow me to import video’s to the devforum, it comes up with some bug??
Sometimes it gets stuck on 100%. Not sure why.
Tom:
RunService.RenderStepped:Connect(function(dt)
if dragging then
UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
local mouseDelta = UIS:GetMouseDelta()
current_mouse_pos_Y = mouseDelta * speed * dt
oldMousePos = current_mouse_pos_Y
--current_mouse_pos_Y.X*speed
CurrentCamera.CFrame *= CFrame.Angles(current_mouse_pos_Y.Y*speed,current_mouse_pos_Y.X,0):Inverse()
end
How is this code meant to work? Is it missing parts?
Where is the speed
variable from? Is speed just a constant? Why do you multiply by the constant twice for the y axis? ALso why is the pos named y but it’s the x and the y?
You probably want to use dt here otherwise it won’t be frame independent. Also make sure you’re intending to use radians as the units. I also don’t think there is a reason to inverse the angles CFrame–I think you can just set the angles to negative to do the same thing.
How4rdy
(wardi)
March 2, 2024, 9:36am
#7
im pretty sure thats just snippet of the code
I found out what the issue was, the Z axis for rotation should be set to 0 so it doesn’t tilt.
1 Like