Jump to content

camera always moving down issue


Rick
 Share

Recommended Posts

When I print out my AND I press the left mouse BUT I don't move the mouse at all, WHY WOULD my RETURN 0.5? mx returns 0 like I would expect but because my is return 0.5 the camera always moves to the bottom.

 

if MouseHit(1) == 1 then
				mouseX = MouseX()
				mouseY = MouseY()
				MoveMouse(GraphicsWidth() / 2, GraphicsHeight() / 2)

				HideMouse()
			end

			if MouseDown(1) == 1 then
				mx = MouseX() - GraphicsWidth()/2
				my = MouseY() - GraphicsHeight()/2
				MoveMouse(GraphicsWidth()/2, GraphicsHeight()/2)

				camRotationY = camRotationY - mx / 4.0
				camRotationX = camRotationX + my / 4.0

				if camRotationX > 25 then
					camRotationX = 25
				end
				if camRotationX < -55 then
					camRotationX = -55
				end

				Print("MouseX = "..mx.." camRotationX = "..camRotationX)
				Print("MouseY = "..my.." camRotationY = "..camRotationY)
				leftMouseDown = true

				RotateEntity(entity.playerPivot, Vec3(camRotationX, camRotationY, 0), 1)
			elseif MouseDown(1) ~= 1 and leftMouseDown == true then
				MoveMouse(mouseX, mouseY)
				ShowMouse()
				leftMouseDown = false
			end

Link to comment
Share on other sites

I think you get smoother movement if you divide by 2.0 instead of 2. Round() usually tends to round down when it should round up, so you might get irregular movements.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Logically, a mouse cannot stand inbetween pixels.

Actually the mouse itself can have like 1000 units per pixel, which you can test by applying a small force to the mouse, and after a while the mouse cursor will move one pixel on the screen.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Actually how can I handle this in the editor? I have 2 monitors and even though they both have the same resolution, the camera is fine on one, and starts moving down automatically on the other. I have no doubt this would work fine outside the editor because I can control the graphics width and height to be a whole number when divided by 2, but in the editor it seems to cause issues.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...