#### Archived

This topic is now archived and is closed to further replies.

# mouse in directx : direction of movement

## Recommended Posts

ilimo    122
hello, how get the direction of mouvement when moving the mouse ? using directx (9) ? perhaps using DIMOUSESTATE , but i don''t know how.. this is for a camera move ... thank you for your help ..

##### Share on other sites
circlesoft    1178
DIMOUSESTATE has lX, lY, and lZ members in it (lZ is commonly for the mouse wheel). With a mouse, these members describe the amount of change, not the actual position.

If lX is less than zero, the user is moving their mouse left, and if greater than zero, they are moving their mouse right (IIRC). If lY is less than zero, the user is moving the mouse down, but if it''s greater than zero, it''s being moved up

##### Share on other sites
ilimo    122
turning left i can,
but turning right i can not..
any idea..?

position.x = (view.x + distance*sinf(rotationY)*sinf(rotationX));position.z = (view.z + distance*cosf(rotationY)*sinf(rotationX));position.y = -(view.y + distance*cosf(rotationX));