Physx :rotate objects with mouse

How rotate physx character using mouse to make FPS control?

How precisely depends on how you actually want to have your control. For example, should there be any lateral latency or insensitive regions.

In general it is the same as you would do for a third person control. Each frame:

  1. Find out how much your mouse has moved sidewards, for example deltaX = 10 pixel left.
  2. From this compute how fast the character should rotate. Usually the more the mouse has moved the faster it should turn. For example: omega = deltaX * sensitivityX. Of course you don’t need to use an linear scale.
  3. Set angular velocity: controller.setOmega(omega).

If you don’t want to work with angular velocities then you can set the heading directly too: controller.setHeading(angle)

Thank you!