run.RenderStepped:Connect(function()
if ViewportFrame.CurrentCamera ~= nil and not inspectDebounce then
local target = ViewportFrame:WaitForChild("Part")
target.Orientation = Vector3.new(mouse.X, mouse.Y) / 4
end
end)
and what it does is it will rotate this brick depending on the players position but the problem is if I move my mouse left and right it will move correctly but if I move it up or down it will rotate it sideways and not up or down so how can I fix this here’s a video of the problem
as you can see when I move my mouse up and down it will rotate not like I intend for it to do
target.CFrame = CFrame.new(0,0,0) --Position in the ViewportFrame
* CFrame.fromAxisAngle(
Vector3.(1,0,0), mouse.Y/4) --Rotation about X-axis
)
* CFrame.fromAxisAngle(
Vector3.new(0,1,0), mouse.X/4) --Rotation about the Y-axis
)
You may want to mess with the second argument to each of the fromAxisAngle constructors. Consider getting the offset from the midpoint multiplying by 2*math.pi and then dividing by some number like 100 (aka one full rotation for every 100 pixels the mouse is offset from the center) ~Roughly speaking.
Also, you may need to modify the rotation vectors (first arguments to the fromAxisAngles constructors to change the order the rotation is applied and maybe the Z-axis instead of the X-axis).
Alright so if yall were wondering I did fix it today and heres my fix the old way I was doing was horrible because I wasnt specifying x and y’s so it was also like setting the z it was weird heres the fixed code