Hello everyone!
Is there anyway i can have a property that displays the rotation(left /right) of the mouselook?
Like,i need to know if i am moving the mouse to left or to right!
I really need a way to achieve this!
I’m sure there are a few ways to do this but here is how I do it. I set this up to rotate the camera on right-mouse click so your needs will probably be a little different. Also there is probably a better way to do this but this works for me.
I have a mouse movement sensor that assigns the xpos of the cursor to a property (if NO right-click). On right-click and move I compare the new xpos to the stored property. If the xpos is greater than the property I rotate left, if less I rotate right.
Here’s some sample code:
move = cont.actuators["Move"]
mm = own.sensors["MouseMove"]
Xpos = mm.position[0]
if rclick.positive and mm.positive:
if Xpos > own["CursorX"]:
cont.activate(move)
move.dRot = (0.0, 0.0, -.4)
else:
cont.activate(move)
move.dRot = (0.0, 0.0, .4)
else:
cont.deactivate(move)
own["CursorX"] = Xpos
Ok,so I want to make a object know if I am moving the mouse at left or at right, the best way it can be done is by using a property that should display if I am going with the mouse on the left side or the right side.