Mouse sensitivity on the Mac - Not looking for mouse scripts

I have been very frustrated lately with the varying performance of the mouse on different platforms. I work mainly with a Mac and have noticed that a lot of the mouse scripts I have found work fine on PC/Win32 machine but when I run the same script on the my Mac (iBook running 2.25 and OSX 10.2x) the movement and sensitivity are out of whack and very hard to control.

When I move the mouse (in any direction) the mouse moves in that direction (and fast), but when I stop the movement the mouse keeps on going. round and round and round. On the PC, the mouse stops moving when I stop moving it.

Now, I could alter the script so that there is more control over the sensitivity and then it takes more movement to get the mouse to turn ot look around (and it still travels on it’s own after you stop moving, just not as fast). Then, I take the script back to a PC and I can barely move the mouse because the sensitivity is way too high.

Has anyone else had this problem? Should I create 2 IPOs and use them to control the Horz. and Vert. movement or will I have the same problem? Should I buy a hampster in a wheel?

Also, I am not asking anyone for a script, there are plenty out there and I would rather write my own. The question is, has anyone had this problem and is there a work around or should I spend my time looking at other options?

Thank you all in advance.

I’ve had sensitivity problems with mouse scripts on Solaris. What seems to work great on Windoze is way too sensitive to use on the Solaris system I’ve tried it out on. I haven’t had problems where it keeps moving like you had though.

The camera continues to rotate after the mouse has stopped moving?

This doesn’t sound like it’s a mouse sensitivity issue, it sounds like the movement actuators are not being deactivated.

Try using an if statement to deactivate the actuators when the mouse stops moving (i.e. when the mouse movement sensor sends a false pulse.)

if mouse_movement.isPositive():
    # ...
    # mouselook code here
    # ...
else:
    GameLogic.addActiveActuator(rotate_verticaly, 0)
    GameLogic.addActiveActuator(rotate_horizontaly, 0)

That though had crossed my mind.
I am going to check it out now and will inform.

Thanks for the big brain.

Oops, spoke too soon. I took a look at my code and it is in a similar fashion to what you recommended.

Left.

-----

if (Xpos < Width):

Move left

XDiff = Xpos - Width
LeftMove.setDRot(0,(XDiff/Own.move),0,1)
addActiveActuator(LeftMove,1)

Shut off all actuator movements.

--------------------------------

addActiveActuator(LeftMove,0)
addActiveActuator(RightMove,0)

I don’t have the time to work on it at the moment (the real job), but should I nest the statements with if/else? I just have them at the end of the script as the last lines before:

Set the mouse to the center of the game screen.

-----------------------------------------------

setMousePosition(Width,Ypos)

Thanks for you time.

Oops again.
I used “Quote” and not “Code”

geez.

Ok, just as an update (if anyone is even listening), I have played with my code and tried nesting the statements to turn off the actuators with if/else, but then the actuators are not moving at all.

I have tried some other scripts and they all work the same way with the exception of a walkthrough script if found on the forum. This one uses a “click and drag” method for aiming which lessens the rotational problems (because when you ley go it stops moving), but when I adjust the code to work when you are not “Clicking and dragging” the rotational sensitivity problem is back.

I am at a stubling point right now. I don’t know enough scripting to make this work properly.

Anyone with a Mac that could help to verify this would be great.
(I have also been thinking that it might be something hardware related,USB, USB Keyboard, or optical mouse? Logitec driver)

peas.

Could it be possible that the command Rasterizer.SetMousePosition() doesn’t work as intended on a mac? That could account for the continued rotation, because as soon as you move the mouse off center its going to think its off center continuously.

Try putting a command in the script:

Rasterizer.showMouse(1)

Then you will see what the real mouse pointer is up to. If the mouse pointer moves around the screen instead of always going back to the center, you know what the problem is. (Although I wouldn’t have a clue how to solve this). If it does warp to the center, check that you are not turning off the actuators, but setting all the rotations to zero and turning them ON. For instance:


rotationx = 0.0
rotationy = 0.0
if mousex changed:
   rotationx = someamount
if mousey changed
   rotationy = someamount
rotation.setDrot(rotationx,rotationy,0,1)
GameLogic.addActiveActuator(rotation,1)

Oh. Also, the problem could be with floats/ints. Make sure in your math that you use float numbers throughout, it can be easy in python code to have a number be an int and not know it. In this case, 0.000000009 which should be zero, could be rounded up to 1 in integer math, making it continually rotate. So make sure all the numbers are floats. Any variables where you aren’t sure whether they are floats or ints, make them floats: variable = float(variable). Make sure you have all floats before you do any dividing or multiplying.

I KNOW!

rasterizer.setMousePosition doesn’t seem to put the mouse at the same location as getx and gety will give you.

one of my mouse scripts had problems with this, I decided to have it reset to one spot, and try to find the getx and gety values for that. Problem is that the mouse must not be moving when I use getx and gety to find that spot. (don’t have it online I don’t think, this file)

setMousePosition() might be generating a mouse movement event on some operating systems. Thus, using setMousePosition() sends another true pulse to the mouse sensor. If that’s the case then the sensor will always be true, so instead check if the mouse isn’t in the center of the window.

# check if mouse isn't centered
if not (mouse_x == center_width and mouse_y == center_height):
	# ...
	# mouselook code here
	# ...
else:
	GameLogic.addActiveActuator(rotate_verticaly, 0)
	GameLogic.addActiveActuator(rotate_horizontaly, 0)

PS. You don’t have to put lines deactivating the actuators in if / else statements, (since they are ignored on frames where the actuator was activated,) but it makes the code cleaner and easier to read.

Well, it seems that Rasterizer.setMousePosition() does not set the mouse. I used Rasterizer.showMouse(1) and behold, the mouse goes wherever you point it but never to the center.

Now, I did some fooling with a combination of scripts and found that even if I get the rotation to stop, the mouse never returns to the center. I get this “sloppy” movement now because you have to return the mouse to the center position before it will travel in the opposite direction. Like being on a see-saw and trying to find the middle or balance point.

I think I can work all of this out with a combination of everyone’s input from this post, but it will take me a little time. I will post back in a day once I do some more work.

Thanks for all the input so far.

That has bit me before

so now that I think about it I may have been wrong about setposition and getx gety being different

Just to add, that I did try the same scripts on both Mac and PC (works on the PC).

Thanks.

Just to throw this in, I’ve experienced the exact same problems with mouse sensitivity, so if you foks figure a solution out, plz post it.

For the record, Im brand spankin new to Blender and the Game Engine (just got the gamekit this weekedn actually).

Though I should post this in a new thread, Ill throw this in right quick in case its a quick problem:
I cant get any sound to work inside the game engine. Cant test play the wavs, they dont work in the game, nothin.

Anyone else have this predicament or know a good solution?

Ahh yes sound. That could be a separate post itself. My version (2.25) for the Mac plays no sound at all as well.

One step at a time.

Thanks.