Class TCastleExamineNavigation
Unit
Declaration
type TCastleExamineNavigation = class(TCastleNavigation)
Description
Navigate the 3D model in examine mode, like you would hold a box with the model inside.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleNavigation
- TCastleExamineNavigation
Overview
Fields
nested const DefaultRotationAccelerationSpeed = 5.0; |
|
nested const DefaultRotationSpeed = 1.0; |
|
nested const DefaultZoomSpeed = 1.0; |
Methods
function Zoom(const Factor: Single): Boolean; override; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override; |
|
function AllowSuspendForInput: boolean; override; |
|
function Press(const Event: TInputPressRelease): boolean; override; |
|
function Release(const Event: TInputPressRelease): boolean; override; |
|
function Motion(const Event: TInputMotion): boolean; override; |
|
function SensorTranslation(const X, Y, Z, Length: Double; const SecondsPassed: Single): boolean; override; |
|
function SensorRotation(const X, Y, Z, Angle: Double; const SecondsPassed: Single): boolean; override; |
|
procedure Init(const AModelBox: TBox3D; const ARadius: Single); deprecated 'use Viewport.Camera.SetWorldView, and set GravityUp, ModelBox, Radius manually'; |
|
function StopRotating: boolean; |
Properties
property Input_Rotate: TInputShortcut read FInput_Rotate; |
|
property Input_Move: TInputShortcut read FInput_Move; |
|
property Input_Zoom: TInputShortcut read FInput_Zoom; |
|
property MouseButtonRotate: TCastleMouseButton
read GetMouseButtonRotate write SetMouseButtonRotate default buttonLeft; deprecated 'use Input_Rotate'; |
|
property MouseButtonMove: TCastleMouseButton
read GetMouseButtonMove write SetMouseButtonMove default buttonMiddle; deprecated 'use Input_Move'; |
|
property MouseButtonZoom: TCastleMouseButton
read GetMouseButtonZoom write SetMouseButtonZoom default buttonRight; deprecated 'use Input_Zoom'; |
|
property Rotations: TQuaternion read GetRotations write SetRotations; |
|
property RotationsAnim: TVector3 read FRotationsAnim write SetRotationsAnim; |
|
property MoveAmount: TVector3 read GetTranslation write SetTranslation; deprecated 'use Translation'; |
|
property Translation: TVector3 read GetTranslation write SetTranslation; |
|
property Turntable: boolean
read FTurntable write FTurntable default false; |
|
property ScaleFactorMin: Single
read FScaleFactorMin write FScaleFactorMin default 0.01; deprecated 'this does nothing now; it was already only a limit in case of orthographic projection'; |
|
property ScaleFactorMax: Single
read FScaleFactorMax write FScaleFactorMax default 100.0; deprecated 'this does nothing now; it was already only a limit in case of orthographic projection'; |
|
property Inputs_Move: T3BoolInputs read FInputs_Move; |
|
property Inputs_Rotate: T3BoolInputs read FInputs_Rotate; |
|
property Input_MoveXInc: TInputShortcut read GetInput_MoveXInc; |
|
property Input_MoveXDec: TInputShortcut read GetInput_MoveXDec; |
|
property Input_MoveYInc: TInputShortcut read GetInput_MoveYInc; |
|
property Input_MoveYDec: TInputShortcut read GetInput_MoveYDec; |
|
property Input_MoveZInc: TInputShortcut read GetInput_MoveZInc; |
|
property Input_MoveZDec: TInputShortcut read GetInput_MoveZDec; |
|
property Input_RotateXInc: TInputShortcut read GetInput_RotateXInc; |
|
property Input_RotateXDec: TInputShortcut read GetInput_RotateXDec; |
|
property Input_RotateYInc: TInputShortcut read GetInput_RotateYInc; |
|
property Input_RotateYDec: TInputShortcut read GetInput_RotateYDec; |
|
property Input_RotateZInc: TInputShortcut read GetInput_RotateZInc; |
|
property Input_RotateZDec: TInputShortcut read GetInput_RotateZDec; |
|
property Input_ScaleLarger: TInputShortcut read FInput_ScaleLarger; |
|
property Input_ScaleSmaller: TInputShortcut read FInput_ScaleSmaller; |
|
property Input_Home: TInputShortcut read FInput_Home; |
|
property Input_StopRotating: TInputShortcut read FInput_StopRotating; |
|
property MouseNavigation: boolean
read GetMouseNavigation write SetMouseNavigation default true; deprecated; |
|
property CenterOfRotation: TVector3 read FCenterOfRotation write FCenterOfRotation; |
|
property RotationEnabled: Boolean read FRotationEnabled write FRotationEnabled default true; |
|
property MoveEnabled: Boolean read FMoveEnabled write FMoveEnabled default true; |
|
property ZoomEnabled default true; |
|
property RotationAccelerate: boolean
read FRotationAccelerate write SetRotationAccelerate default true; |
|
property ExactMovement: Boolean read FExactMovement write FExactMovement default true; |
|
property AutoCenterOfRotation: Boolean read FAutoCenterOfRotation write FAutoCenterOfRotation default true; |
|
property DragMoveSpeed: Single read FDragMoveSpeed write FDragMoveSpeed default 1.0; |
|
property KeysMoveSpeed: Single read FKeysMoveSpeed write FKeysMoveSpeed default 1.0; |
|
property RotationAccelerationSpeed: Single
read FRotationAccelerationSpeed
write FRotationAccelerationSpeed
default DefaultRotationAccelerationSpeed; |
|
property RotationSpeed: Single
read FRotationSpeed
write FRotationSpeed
default DefaultRotationSpeed; |
|
property ZoomSpeed: Single
read FZoomSpeed
write FZoomSpeed
default DefaultZoomSpeed; |
Description
Fields
nested const DefaultRotationAccelerationSpeed = 5.0; |
|
This item has no description. |
nested const DefaultRotationSpeed = 1.0; |
|
This item has no description. |
nested const DefaultZoomSpeed = 1.0; |
|
This item has no description. |
Methods
function Zoom(const Factor: Single): Boolean; override; |
|
This item has no description. Showing description inherited from TCastleNavigation.Zoom. Zoom in / out. Negative Factor makes "zoom out", positive makes "zoom in" (zero makes nothing). Called only if ZoomEnabled, so no need to check it within implementation. Factor values correspond to TInputPressRelease.MouseWheelScroll values, so 1.0 should be treated like a "one operation" and some systems only generate values -1 or +1 (and never fractions). |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
This item has no description. Showing description inherited from TCastleComponent.PropertySections. Section where to show property in the editor. |
procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Update. Control may do here anything that must be continuously repeated. E.g. camera handles here falling down due to gravity, rotating model in Examine mode, and many more.
This method may be used, among many other things, to continuously react to the fact that user pressed some key (or mouse button). For example, if holding some key should move some 3D object, you should do something like: if HandleInput then begin if Container.Pressed[keyArrowRight] then begin Transform.Position := Transform.Position + Vector3(SecondsPassed * 10, 0, 0); HandleInput := false; end; end;
Instead of directly using a key code, consider also using TInputShortcut that makes the input key nicely configurable. See engine tutorial about handling inputs. Multiplying movement by SecondsPassed makes your operation frame-rate independent. Object will move by 10 units in a second, regardless of how many FPS your game has. The code related to HandleInput is important if you write a generally-useful control that should nicely cooperate with all other controls, even when placed on top of them or under them. The correct approach is to only look at pressed keys/mouse buttons if HandleInput is Note that to handle a single press / release (like "switch light on when pressing a key") you should rather use Press and Release methods. Use this method only for continuous handling (like "holding this key makes the light brighter and brighter"). To understand why such HandleInput approach is needed, realize that the "Update" events are called differently than simple mouse and key events like "Press" and "Release". "Press" and "Release" events return whether the event was somehow "handled", and the container passes them only to the controls under the mouse (decided by TCastleUserInterface.CapturesEventsAtPosition). And as soon as some control says it "handled" the event, other controls (even if under the mouse) will not receive the event. This approach is not suitable for Update events. Some controls need to do the Update job all the time, regardless of whether the control is under the mouse and regardless of what other controls already did. So all controls (well, all controls that exist, in case of TCastleUserInterface, see TCastleUserInterface.Exists) receive Update calls. So the "handled" status is passed through HandleInput. If a control is not under the mouse, it will receive HandleInput = |
function AllowSuspendForInput: boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.AllowSuspendForInput.
Allow window containing this control to suspend waiting for user input. Typically you want to override this to return In this class, this simply returns always |
function Press(const Event: TInputPressRelease): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Press.
Override this method to react to user pressing a key, mouse button or mouse wheel. Return When implementing in descendants it is best to override it like this: function TMyControl.Press(const Event: TInputPressRelease): boolean; begin Result := inherited; if Result then Exit; // exit if ancestor already handled this event if Event.IsKey(keyEnter) then begin // do something in reaction to Enter key ... // let engine know that this input event was handled Exit(true); end; if Event.IsMouseButton(buttonLeft) then begin // do something in reaction to left mouse button press ... // let engine know that this input event was handled Exit(true); end; end;
These events are generated for all UI controls, whether they are considered "interactive" or not. These events are generated for non-interactive controls like TCastleRectangleControl or TCastleLabel as well. For example, these events ignore the TCastleButton.Enabled state, they are generated always (see https://github.com/castle-engine/castle-engine/issues/413 ). Use instead TCastleButton.OnClick to detect clicks on a button in a way that honors the TCastleButton.Enabled state. When a control returns The events Press and Release are passed to the parent only after the children had a chance to process this event. Overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.Render, which is the standard place you should draw stuff. For example our TCastleButton draws there. In contrast, the events PreviewPress and PreviewRelease are passed first to the parent control, before children have a chance to process this event. In partcular, overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.RenderOverChildren. |
function Release(const Event: TInputPressRelease): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Release.
Override this method to react to user releasing a key, mouse button. Return This is counterpart to Press method. See Press for more details. Note: We'd like this method to also be called when user releases a mouse wheel. But currently releasing of the mouse wheel is not reported now by any backend. Only releasing of keys and mouse buttons is reported. |
function Motion(const Event: TInputMotion): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Motion. Motion of mouse or touch. |
function SensorTranslation(const X, Y, Z, Length: Double; const SecondsPassed: Single): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.SensorTranslation. Translation detected by 3D sensor. Used for example by 3Dconnexion devices.
|
function SensorRotation(const X, Y, Z, Angle: Double; const SecondsPassed: Single): boolean; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.SensorRotation. Rotation detected by 3D sensor. Used for example by 3Dconnexion devices.
|
procedure Init(const AModelBox: TBox3D; const ARadius: Single); deprecated 'use Viewport.Camera.SetWorldView, and set GravityUp, ModelBox, Radius manually'; |
|
Warning: this symbol is deprecated: use Viewport.Camera.SetWorldView, and set GravityUp, ModelBox, Radius manually Initialize most important properties of this class: sets ModelBox and goes to a nice view over the entire scene. In other words, this is just a shortcut to setting ModelBox, and setting suitable view by SetWorldView. |
function StopRotating: boolean; |
|
Sets RotationsAnim to zero, stopping the rotation of the model. |
Properties
property Input_Rotate: TInputShortcut read FInput_Rotate; |
|
Which input (like mouse button) should rotate the model. By default this is left mouse button. |
property Input_Move: TInputShortcut read FInput_Move; |
|
Which input (like mouse button) should move the model. By default this is middle mouse button, or left mouse button while holding Shift. |
property Input_Zoom: TInputShortcut read FInput_Zoom; |
|
Which input (like mouse button) should zoom (look closer / further at model). By default this is right mouse button, or left mouse button while holding Ctrl. |
property MouseButtonRotate: TCastleMouseButton
read GetMouseButtonRotate write SetMouseButtonRotate default buttonLeft; deprecated 'use Input_Rotate'; |
|
Warning: this symbol is deprecated: use Input_Rotate This item has no description. |
property MouseButtonMove: TCastleMouseButton
read GetMouseButtonMove write SetMouseButtonMove default buttonMiddle; deprecated 'use Input_Move'; |
|
Warning: this symbol is deprecated: use Input_Move This item has no description. |
property MouseButtonZoom: TCastleMouseButton
read GetMouseButtonZoom write SetMouseButtonZoom default buttonRight; deprecated 'use Input_Zoom'; |
|
Warning: this symbol is deprecated: use Input_Zoom This item has no description. |
property Rotations: TQuaternion read GetRotations write SetRotations; |
|
Current rotation of the model. Rotation is done around ModelBox middle (with Translation added). |
property RotationsAnim: TVector3 read FRotationsAnim write SetRotationsAnim; |
|
Continuous rotation animation, applied each Update to Rotations. |
property MoveAmount: TVector3 read GetTranslation write SetTranslation; deprecated 'use Translation'; |
|
Warning: this symbol is deprecated: use Translation This item has no description. |
property Translation: TVector3 read GetTranslation write SetTranslation; |
|
How much to move the model. By default, zero. |
property Turntable: boolean
read FTurntable write FTurntable default false; |
|
|
property Inputs_Move: T3BoolInputs read FInputs_Move; |
|
Alternative ways to access Input_Move/Rotate(X|Y|Z)(Inc|Dec). Index the array (2nd index true means increase) instead of having to use the full identifier. |
property Inputs_Rotate: T3BoolInputs read FInputs_Rotate; |
|
This item has no description. |
property Input_MoveXInc: TInputShortcut read GetInput_MoveXInc; |
|
This item has no description. |
property Input_MoveXDec: TInputShortcut read GetInput_MoveXDec; |
|
This item has no description. |
property Input_MoveYInc: TInputShortcut read GetInput_MoveYInc; |
|
This item has no description. |
property Input_MoveYDec: TInputShortcut read GetInput_MoveYDec; |
|
This item has no description. |
property Input_MoveZInc: TInputShortcut read GetInput_MoveZInc; |
|
This item has no description. |
property Input_MoveZDec: TInputShortcut read GetInput_MoveZDec; |
|
This item has no description. |
property Input_RotateXInc: TInputShortcut read GetInput_RotateXInc; |
|
This item has no description. |
property Input_RotateXDec: TInputShortcut read GetInput_RotateXDec; |
|
This item has no description. |
property Input_RotateYInc: TInputShortcut read GetInput_RotateYInc; |
|
This item has no description. |
property Input_RotateYDec: TInputShortcut read GetInput_RotateYDec; |
|
This item has no description. |
property Input_RotateZInc: TInputShortcut read GetInput_RotateZInc; |
|
This item has no description. |
property Input_RotateZDec: TInputShortcut read GetInput_RotateZDec; |
|
This item has no description. |
property Input_ScaleLarger: TInputShortcut read FInput_ScaleLarger; |
|
This item has no description. |
property Input_ScaleSmaller: TInputShortcut read FInput_ScaleSmaller; |
|
This item has no description. |
property Input_Home: TInputShortcut read FInput_Home; |
|
This item has no description. |
property Input_StopRotating: TInputShortcut read FInput_StopRotating; |
|
This item has no description. |
property MouseNavigation: boolean
read GetMouseNavigation write SetMouseNavigation default true; deprecated; |
|
Warning: this symbol is deprecated. Include/exclude niMouseDragging from Input instead. |
property CenterOfRotation: TVector3 read FCenterOfRotation write FCenterOfRotation; |
|
3D point around which we rotate, in world coordinates. This is used only when AutoCenterOfRotation = |
property RotationEnabled: Boolean read FRotationEnabled write FRotationEnabled default true; |
|
Enable rotating the camera around the model by user input. When Note that this doesn't prevent from rotating by code, e.g. by setting Rotations property or calling Camera.SetWorldView. |
property MoveEnabled: Boolean read FMoveEnabled write FMoveEnabled default true; |
|
Enable moving the camera by user input. When Note that this doesn't prevent from moving by code, e.g. by setting Translation property or calling Camera.SetWorldView. |
property ZoomEnabled default true; |
|
This item has no description. Showing description inherited from TCastleNavigation.ZoomEnabled.
Enable zooming in / out. Depending on the projection, zooming either moves camera or scales the projection size. When |
property AutoCenterOfRotation: Boolean read FAutoCenterOfRotation write FAutoCenterOfRotation default true; |
|
Should we calculate center of rotation automatically (based on world bounding box) or use explicit CenterOfRotation. |
property DragMoveSpeed: Single read FDragMoveSpeed write FDragMoveSpeed default 1.0; |
|
How fast user moves the scene by mouse/touch dragging. |
property KeysMoveSpeed: Single read FKeysMoveSpeed write FKeysMoveSpeed default 1.0; |
|
How fast user moves the scene by pressing keys. |
property RotationAccelerationSpeed: Single
read FRotationAccelerationSpeed
write FRotationAccelerationSpeed
default DefaultRotationAccelerationSpeed; |
|
Speed to change the rotation acceleration, used when RotationAccelerate = |
property RotationSpeed: Single
read FRotationSpeed
write FRotationSpeed
default DefaultRotationSpeed; |
|
Speed to change the rotation, used when RotationAccelerate = |
property ZoomSpeed: Single
read FZoomSpeed
write FZoomSpeed
default DefaultZoomSpeed; |
|
Speed to change the Zoom, when ZoomEnabled = |
Generated by PasDoc 0.16.0-snapshot.