Click or drag to resize
AB4D logo

MouseCameraControllerRotateAroundMousePosition Property

Gets or sets a Boolean that specifies if TargetPositionCamera or FreeCamera is rotated around a 3D position that is "behind" current mouse position. When RotateAroundMousePosition is true and user starts cameras rotation, MouseCameraController sets the TargetPositionCamera.RotationCenterPosition or FreeCamera.RotationCenterPosition property. Default value is false.

Namespace: Ab3d.Controls
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.2.9104.2045
Syntax
C#
public bool RotateAroundMousePosition { get; set; }

Property Value

Boolean
Remarks

RotateAroundMousePosition gets or sets a Boolean that specifies if TargetPositionCamera or FreeCamera is rotated around a 3D position that is "behind" current mouse position.

The 3D position behind the mouse position is calculated with calling the GetRotationCenterPositionFromMousePosition(Point, Boolean) method that uses hit testing to return the 3D position. The result of GetRotationCenterPositionFromMousePosition is set to the TargetPositionCamera.RotationCenterPosition or FreeCamera.RotationCenterPosition property before starting the rotation.

When there is no object "behind" the mouse, then a standard rotation with changing only Heading and Attitude properties is used. In case of TargetPositionCamera or FreeCamera this means that the scene is rotated around TargetPosition which is shown at the center of Viewport3D and not around the position where the mouse is.

To provide custom 3D position when camera rotation is started, you can create a new class that is derived from MouseCameraController and override the GetRotationCenterPositionFromMousePosition method. This can be used for example to rotate around 3D position that lies on a horizontal plane that goes through (0, 0, 0).

IMPORTANT:
RotateAroundMousePosition works only with TargetPositionCamera and FreeCamera cameras (other cameras do not have RotationCenterPosition property).

Default value is false.

See Also