This project is read-only.

Mouse Scroll

May 17, 2009 at 2:00 AM


I added a firstpersoncontrolledcamera3d in the game, you can make the camera closer or away with the scroll mouse?

May 17, 2009 at 2:13 AM

What you describe sounds like a 3rd person camera.

If you want to zoom in / out, then you can change the field of view of the camera (camera.Projection.FieldOfView).

UpdateState provides direct access to the mouse state (state.MouseState). You can also map PlayerInput controls to the mouse wheel (however, only analog controls, such as the triggers can be mapped to the wheel). This can be done with KeyboardMouseControlMapping.

So, for example:

	float wheelDelta = state.MouseState.ScrollWheelDelta;

	if (wheelDelta > 5) wheelDelta = 5;
	if (wheelDelta < -5) wheelDelta = -5; *= 1.0f + wheelDelta * 0.1f;
May 17, 2009 at 6:35 PM

Perfect, tkx for awser