Click or drag to resize
Ab4d.SharpEngine logo

CameraControllerRotateAroundPointerPosition Property

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

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public bool RotateAroundPointerPosition { get; set; }

Property Value

Boolean
Remarks

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

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

When there is no object "behind" the pointer, 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 pointer is.

To provide custom 3D position when camera rotation is started, you can create a new class that is derived from PointerCameraController and override the GetRotationCenterPositionFromPointerPosition 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:
RotateAroundPointerPosition works only with TargetPositionCamera and FreeCamera cameras (other cameras do not have RotationCenterPosition property).

Default value is false.

See Also