Rick Posted December 16, 2009 Share Posted December 16, 2009 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 Quote Link to comment Share on other sites More sharing options...
Rick Posted December 16, 2009 Author Share Posted December 16, 2009 Oh I see. GraphicsWidth()/2 has a .5 but MouseX() seems to return an integer only even if I do a MoveMouse(GraphcisWidth()/2). Guess I just need to drop the decimal. Quote Link to comment Share on other sites More sharing options...
Niosop Posted December 16, 2009 Share Posted December 16, 2009 Isn't it in pixels? Can the mouse move fractional pixels? Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
Rick Posted December 16, 2009 Author Share Posted December 16, 2009 I had to make a simple round() method since GraphicsWidth()/2 was returning a decimal number. It seems ok now. Quote Link to comment Share on other sites More sharing options...
L B Posted December 16, 2009 Share Posted December 16, 2009 Logically, a mouse cannot stand inbetween pixels. Quote Link to comment Share on other sites More sharing options...
Canardia Posted December 16, 2009 Share Posted December 16, 2009 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Canardia Posted December 16, 2009 Share Posted December 16, 2009 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
L B Posted December 16, 2009 Share Posted December 16, 2009 It can move between pixels, however it cannot stand between them. But we both understand this. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 17, 2009 Author Share Posted December 17, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.