-
What do i want to achieve?
I want to make camera rotate depending on player mouse position -
What is the issue?
so the issue is camera rotates by its own axis, so rotations are getting weird
robloxapp-20240827-1658217.wmv (1,7 МБ) -
What solutions have i tried so far?
I tried searching on forum, but only found how to rotate camera around part by only one axis
Here is the code
mouse.Move:Connect(function()
if UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) and EditingWeapon then
rotatedCFrame = rotatedCFrame.Rotation
rotatedCFrame *= smith.CFrame * offset * smith.CFrame:ToWorldSpace(CFrame.Angles(math.rad((lasmPos.Y - mouse.Y)/5), math.rad((lasmPos.X - mouse.X)/3), 0))
cam.CFrame = smith.CFrame:ToWorldSpace(rotatedCFrame)
cam.CFrame = CFrame.new(cam.CFrame.Position, smith.Position)
end
lasmPos = Vector2.new(mouse.X, mouse.Y)
end)