Class TCastleNavigation
Unit
Declaration
type TCastleNavigation = class(TCastleUserInterface)
Description
Handle user input to modify viewport's camera.
Create an instance of this class, and set it as TCastleViewport.Navigation value. It will become a child control of the associated TCastleViewport.
In many ways, this is just a normal TCastleUserInterface descendant. E.g. it processes input just like any other TCastleUserInterface descendant (there isn't any special mechanism through which TCastleViewport passes input to the navigation), the Exists property works and so on. Setting it as TCastleViewport.Navigation (as opposed to just adding it manually by TCastleUserInterface.InsertFront to the viewport) serves just two purposes: we set internal link to the viewport, and we make sure to remove previous TCastleViewport.Navigation value from children.
The point of the above explanation is that you can modify TCastleViewport.Camera (move, rotate and do other stuff with camera) from any place in the code. You don't need to use an ancestor of TCastleNavigation
to manipulate the camera. TCastleNavigation
is a comfortable way to encapsulate common navigation methods, but it's not the only way to move the camera.
Various TCastleNavigation
descendants implement various navigation methods, for example TCastleExamineNavigation allows the user to rotate and scale the model (imagine that you're holding a 3D model in your hands and you look at it from various sides) and TCastleWalkNavigation implements typical navigation in the style of first-person shooter games.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TInputListener
- TCastleUserInterface
- TCastleNavigation
Overview
Fields
![]() |
MouseDraggingStarted: Integer; |
![]() |
MouseDraggingStart: TVector2; |
![]() |
nested const DefaultRadius = 0.25; |
![]() |
nested const DefaultPreferredHeight = 1.6; |
![]() |
nested const DefaultInput = [niNormal, niMouseDragging, ni3dMouse, niGesture]; |
![]() |
nested const DefaultHeadBobbingTime = 0.5; |
![]() |
nested const DefaultHeadBobbing = 0.02; |
![]() |
nested const DefaultCrouchHeight = 0.5; |
Methods
![]() |
procedure SetInput(const Value: TNavigationInputs); virtual; |
![]() |
function GetIgnoreAllInputs: boolean; |
![]() |
procedure SetIgnoreAllInputs(const Value: boolean); |
![]() |
procedure SetRadius(const Value: Single); virtual; |
![]() |
function ReallyEnableMouseDragging: boolean; virtual; |
![]() |
procedure SetModelBox(const B: TBox3D); |
![]() |
procedure Height(const APosition: TVector3; out AIsAbove: Boolean; out AnAboveHeight: Single; out AnAboveGround: PTriangle); |
![]() |
function MoveAllowed( const OldPos: TVector3; ProposedNewPos: TVector3; out NewPos: TVector3; const Radius: Single; const BecauseOfGravity: Boolean): Boolean; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
procedure Assign(Source: TPersistent); override; |
![]() |
function GetExists: boolean; override; |
![]() |
function Camera: TCastleCamera; |
![]() |
function Matrix: TMatrix4; deprecated 'use Viewport.Camera.Matrix'; |
![]() |
function MatrixInverse: TMatrix4; deprecated 'use Viewport.Camera.MatrixInverse'; |
![]() |
function RotationMatrix: TMatrix4; deprecated 'use Viewport.Camera.RotationMatrix'; |
![]() |
procedure GetView(out APos, ADir, AUp: TVector3); overload; deprecated 'use Viewport.Camera.GetView'; |
![]() |
procedure GetView(out APos, ADir, AUp, AGravityUp: TVector3); overload; deprecated 'use Viewport.Camera.GetView'; |
![]() |
procedure SetView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true); overload; deprecated 'use Viewport.Camera.SetView'; |
![]() |
procedure SetView(const APos, ADir, AUp, AGravityUp: TVector3; const AdjustUp: boolean = true); overload; deprecated 'use Viewport.Camera.SetView'; |
![]() |
procedure Ray(const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); deprecated 'use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead'; |
![]() |
procedure MouseRay( const Projection: TProjection; out RayOrigin, RayDirection: TVector3); deprecated 'use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead'; |
![]() |
procedure CustomRay( const ViewportRect: TRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); overload; deprecated 'use Viewport.Camera.CustomRay'; |
![]() |
procedure CustomRay( const ViewportRect: TFloatRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); overload; deprecated 'use Viewport.Camera.CustomRay'; |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
![]() |
procedure AnimateTo(const OtherCamera: TCastleCamera; const Time: TFloatTime); deprecated 'use Viewport.Camera.AnimateTo'; |
![]() |
procedure AnimateTo(const OtherNavigation: TCastleNavigation; const Time: TFloatTime); deprecated 'use AnimateTo with TCastleCamera, not TCastleNavigation'; |
![]() |
procedure AnimateTo(const APos, ADir, AUp: TVector3; const Time: TFloatTime); deprecated 'use Viewport.Camera.AnimateTo'; |
![]() |
function Animation: boolean; deprecated 'use Viewport.Camera.Animation'; |
![]() |
function InitialPosition: TVector3; deprecated 'use Viewport.Camera.InitialPosition'; |
![]() |
function InitialDirection: TVector3; deprecated 'use Viewport.Camera.InitialDirection'; |
![]() |
function InitialUp: TVector3; deprecated 'use Viewport.Camera.InitialUp'; |
![]() |
procedure SetInitialView( const AInitialPosition: TVector3; AInitialDirection, AInitialUp: TVector3; const TransformCurrentCamera: boolean); deprecated 'use Viewport.Camera.SetInitialView'; |
![]() |
procedure GoToInitial; deprecated 'use Viewport.Camera.GoToInitial'; |
![]() |
function GetNavigationType: TNavigationType; virtual; |
![]() |
procedure CorrectPreferredHeight; |
Properties
![]() |
property OnMoveAllowed: TMoveAllowedFunc read FOnMoveAllowed write FOnMoveAllowed; |
![]() |
property OnInternalMoveAllowed: TMoveAllowedFunc
read FOnInternalMoveAllowed write FOnInternalMoveAllowed; |
![]() |
property OnInternalHeight: THeightEvent read FOnInternalHeight write FOnInternalHeight; |
![]() |
property OnFall: TFallNotifyFunc read FOnFall write FOnFall; |
![]() |
property IgnoreAllInputs: boolean
read GetIgnoreAllInputs write SetIgnoreAllInputs default false; deprecated; |
![]() |
property Frustum: TFrustum read GetFrustum; deprecated 'use Viewport.Camera.Frustum'; |
![]() |
property ProjectionMatrix: TMatrix4
read GetProjectionMatrix write SetProjectionMatrix; deprecated 'use Viewport.Camera.ProjectionMatrix'; |
![]() |
property Radius: Single read FRadius write SetRadius default DefaultRadius; |
![]() |
property Position : TVector3 read GetPosition write SetPosition; deprecated 'use Viewport.Camera.Position'; |
![]() |
property Direction: TVector3 read GetDirection write SetDirection; deprecated 'use Viewport.Camera.Direction'; |
![]() |
property Up : TVector3 read GetUp write SetUp; deprecated 'use Viewport.Camera.Up'; |
![]() |
property GravityUp: TVector3 read GetGravityUp write SetGravityUp; deprecated 'use Viewport.Camera.GravityUp'; |
![]() |
property PreferredHeight: Single
read FPreferredHeight write FPreferredHeight default DefaultPreferredHeight; |
![]() |
property CrouchHeight: Single
read FCrouchHeight write FCrouchHeight default DefaultCrouchHeight; |
![]() |
property HeadBobbing: Single
read FHeadBobbing write FHeadBobbing default DefaultHeadBobbing; |
![]() |
property HeadBobbingTime: Single
read FHeadBobbingTime write FHeadBobbingTime
default DefaultHeadBobbingTime; |
![]() |
property MoveHorizontalSpeed: Single
read FMoveHorizontalSpeed write FMoveHorizontalSpeed default 1.0; |
![]() |
property MoveVerticalSpeed: Single
read FMoveVerticalSpeed write FMoveVerticalSpeed default 1.0; |
![]() |
property MoveSpeed: Single read FMoveSpeed write FMoveSpeed default 1.0; |
![]() |
property ClimbHeight: Single read FClimbHeight write FClimbHeight; |
![]() |
property ModelBox: TBox3D read FModelBox write SetModelBox; |
![]() |
property Input: TNavigationInputs read FInput write SetInput default DefaultInput; |
![]() |
property FullSize default true; |
Description
Fields
![]() |
MouseDraggingStarted: Integer; |
Needed for niMouseDragging navigation. Checking |
![]() |
MouseDraggingStart: TVector2; |
![]() |
nested const DefaultRadius = 0.25; |
Default value for TCastleNavigation.Radius. Matches the default VRML/X3D NavigationInfo.avatarSize[0]. |
![]() |
nested const DefaultPreferredHeight = 1.6; |
Default value for TCastleNavigation.PreferredHeight. Matches the default VRML/X3D NavigationInfo.avatarSize[1]. |
![]() |
nested const DefaultInput = [niNormal, niMouseDragging, ni3dMouse, niGesture]; |
![]() |
nested const DefaultHeadBobbingTime = 0.5; |
![]() |
nested const DefaultHeadBobbing = 0.02; |
![]() |
nested const DefaultCrouchHeight = 0.5; |
Methods
![]() |
procedure SetInput(const Value: TNavigationInputs); virtual; |
![]() |
function GetIgnoreAllInputs: boolean; |
![]() |
procedure SetIgnoreAllInputs(const Value: boolean); |
![]() |
procedure SetRadius(const Value: Single); virtual; |
![]() |
function ReallyEnableMouseDragging: boolean; virtual; |
![]() |
procedure SetModelBox(const B: TBox3D); |
![]() |
procedure Height(const APosition: TVector3; out AIsAbove: Boolean; out AnAboveHeight: Single; out AnAboveGround: PTriangle); |
Check collisions to determine how high above ground is given point. Calls OnInternalHeight callback. |
![]() |
function MoveAllowed( const OldPos: TVector3; ProposedNewPos: TVector3; out NewPos: TVector3; const Radius: Single; const BecauseOfGravity: Boolean): Boolean; |
Check collisions to determine can the object move. Object wants to move from OldPos to ProposedNewPos. Returns If you're doing a simple check for collisions, you will always want to set NewPos to ProposedNewPos when returning But you can also do more sophisticated calculations and sometimes not allow user to move to ProposedNewPos, but allow him to move instead to some other close position. For example when doing "wall sliding" (common in FPS games): when you're trying to walk "into the wall", you move along the wall instead. It's allowed to modify NewPos when returning BecauseOfGravity says whether this move is caused by gravity dragging the player down. You can use BecauseOfGravity e.g. to implement TCastleViewport.PreventInfiniteFallingDown. Implementation calls OnMoveAllowed and OnInternalMoveAllowed. |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
procedure Assign(Source: TPersistent); override; |
![]() |
function GetExists: boolean; override; |
![]() |
function Camera: TCastleCamera; |
Associated TCastleCamera of the viewport. Exceptions raised
|
![]() |
function Matrix: TMatrix4; deprecated 'use Viewport.Camera.Matrix'; |
Warning: this symbol is deprecated: use Viewport.Camera.Matrix Camera matrix, transforming from world space into camera space. |
![]() |
function MatrixInverse: TMatrix4; deprecated 'use Viewport.Camera.MatrixInverse'; |
Warning: this symbol is deprecated: use Viewport.Camera.MatrixInverse Inverse of Matrix, transforming from camera space into world space. |
![]() |
function RotationMatrix: TMatrix4; deprecated 'use Viewport.Camera.RotationMatrix'; |
Warning: this symbol is deprecated: use Viewport.Camera.RotationMatrix Extract only rotation from your current camera Matrix. This is useful for rendering skybox in 3D programs (e.g. for VRML/X3D Background node) and generally to transform directions between world and camera space. It's guaranteed that this is actually only 3x3 matrix, the 4th row and 4th column are all zero except the lowest right item which is 1.0. |
![]() |
procedure GetView(out APos, ADir, AUp: TVector3); overload; deprecated 'use Viewport.Camera.GetView'; |
Warning: this symbol is deprecated: use Viewport.Camera.GetView Express current view as camera vectors: position, direction, up. Returned Dir and Up must be orthogonal. Returned Dir and Up and GravityUp are already normalized. |
![]() |
procedure GetView(out APos, ADir, AUp, AGravityUp: TVector3); overload; deprecated 'use Viewport.Camera.GetView'; |
Warning: this symbol is deprecated: use Viewport.Camera.GetView |
![]() |
procedure SetView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true); overload; deprecated 'use Viewport.Camera.SetView'; |
Warning: this symbol is deprecated: use Viewport.Camera.SetView Set camera view from vectors: position, direction, up. Direction, Up and GravityUp do not have to be normalized, we will normalize them internally if necessary. But make sure they are non-zero. We will automatically fix Direction and Up to be orthogonal, if necessary: when AdjustUp = |
![]() |
procedure SetView(const APos, ADir, AUp, AGravityUp: TVector3; const AdjustUp: boolean = true); overload; deprecated 'use Viewport.Camera.SetView'; |
Warning: this symbol is deprecated: use Viewport.Camera.SetView |
![]() |
procedure Ray(const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); deprecated 'use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead'; |
Warning: this symbol is deprecated: use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead Calculate a 3D ray picked by the WindowX, WindowY position on the window. Uses current container size, which means that it assumes that viewport fills the whole window, and requires that it's added to TCastleViewport.Navigation and this TCastleViewport must be part of TCastleWindowBase.Controls or TCastleControlBase.Controls. Projection (read-only here) describe your projection, required for calculating the ray properly. Resulting RayDirection is always normalized. WindowPosition is given in the same style as TUIContainer.MousePosition: (0, 0) is bottom-left. |
![]() |
procedure MouseRay( const Projection: TProjection; out RayOrigin, RayDirection: TVector3); deprecated 'use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead'; |
Warning: this symbol is deprecated: use Viewport.Camera.CustomRay with proper viewport sizes, or use higher-level utilities like Viewport.MouseRayHit instead Calculate a ray picked by current mouse position on the window. Uses current container size, which means that it assumes that viewport fills the whole window, and requires that it's added to TCastleViewport.Navigation and this TCastleViewport must be part of TCastleWindowBase.Controls or TCastleControlBase.Controls.
See also |
![]() |
procedure CustomRay( const ViewportRect: TRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); overload; deprecated 'use Viewport.Camera.CustomRay'; |
Warning: this symbol is deprecated: use Viewport.Camera.CustomRay Calculate a ray picked by WindowPosition position on the viewport, assuming current viewport dimensions are as given. This doesn't look at our container sizes at all. Projection (read-only here) describe projection, required for calculating the ray properly. Resulting RayDirection is always normalized. WindowPosition is given in the same style as TUIContainer.MousePosition: (0, 0) is bottom-left. |
![]() |
procedure CustomRay( const ViewportRect: TFloatRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); overload; deprecated 'use Viewport.Camera.CustomRay'; |
Warning: this symbol is deprecated: use Viewport.Camera.CustomRay |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
![]() |
procedure AnimateTo(const OtherCamera: TCastleCamera; const Time: TFloatTime); deprecated 'use Viewport.Camera.AnimateTo'; |
Warning: this symbol is deprecated: use Viewport.Camera.AnimateTo |
![]() |
procedure AnimateTo(const OtherNavigation: TCastleNavigation; const Time: TFloatTime); deprecated 'use AnimateTo with TCastleCamera, not TCastleNavigation'; |
Warning: this symbol is deprecated: use AnimateTo with TCastleCamera, not TCastleNavigation |
![]() |
procedure AnimateTo(const APos, ADir, AUp: TVector3; const Time: TFloatTime); deprecated 'use Viewport.Camera.AnimateTo'; |
Warning: this symbol is deprecated: use Viewport.Camera.AnimateTo |
![]() |
function Animation: boolean; deprecated 'use Viewport.Camera.Animation'; |
Warning: this symbol is deprecated: use Viewport.Camera.Animation |
![]() |
function InitialPosition: TVector3; deprecated 'use Viewport.Camera.InitialPosition'; |
Warning: this symbol is deprecated: use Viewport.Camera.InitialPosition |
![]() |
function InitialDirection: TVector3; deprecated 'use Viewport.Camera.InitialDirection'; |
Warning: this symbol is deprecated: use Viewport.Camera.InitialDirection |
![]() |
function InitialUp: TVector3; deprecated 'use Viewport.Camera.InitialUp'; |
Warning: this symbol is deprecated: use Viewport.Camera.InitialUp |
![]() |
procedure SetInitialView( const AInitialPosition: TVector3; AInitialDirection, AInitialUp: TVector3; const TransformCurrentCamera: boolean); deprecated 'use Viewport.Camera.SetInitialView'; |
Warning: this symbol is deprecated: use Viewport.Camera.SetInitialView |
![]() |
procedure GoToInitial; deprecated 'use Viewport.Camera.GoToInitial'; |
Warning: this symbol is deprecated: use Viewport.Camera.GoToInitial |
![]() |
function GetNavigationType: TNavigationType; virtual; |
By default this returns ntNone. Internal navigation descendants can return something else, to cooperate with TCastleViewport.NavigationType. Your custom navigation descendants can just return ntNone. |
![]() |
procedure CorrectPreferredHeight; |
Correct PreferredHeight based on Radius and on current HeadBobbing. Exactly what and why is done: if you do any kind of collision detection with some Radius, then you should make sure that RealPreferredHeight is always >= of your Radius, otherwise strange effects may happen when crouching or when head bobbing forces camera to go down. Exactly, the required equation is MinimumRealPreferredHeight := PreferredHeight * CrouchHeight * (1 - HeadBobbing);
and always must be MinimumRealPreferredHeight >= RealPreferredHeight
Reasoning: otherwise this class would "want camera to fall down" (because we will always be higher than RealPreferredHeight) but your OnMoveAllowed would not allow it (because Radius would not allow it). This method will make sure that this condition holds by eventually adjusting (making larger) PreferredHeight. Note that for Radius = 0.0 this will always leave PreferredHeight as it is. |
Properties
![]() |
property OnMoveAllowed: TMoveAllowedFunc read FOnMoveAllowed write FOnMoveAllowed; |
Used by MoveAllowed, see there for description. You can assign this property. |
![]() |
property OnInternalMoveAllowed: TMoveAllowedFunc
read FOnInternalMoveAllowed write FOnInternalMoveAllowed; |
Used by MoveAllowed, see there for description. This property is used internally by TCastleViewport. |
![]() |
property OnInternalHeight: THeightEvent read FOnInternalHeight write FOnInternalHeight; |
Assign here the callback to check collisions and determine what is the current height of position above the ground. This should be calculated like collision of ray from Position in direction -GravityUp with the world. See TCastleTransform.Height for specification what returned parameters mean. |
![]() |
property OnFall: TFallNotifyFunc read FOnFall write FOnFall; |
Notification that we have been falling down for some time due to gravity, and suddenly stopped (which means we "hit the ground"). This event can be useful in games, for example to lower player's health, and/or make a visual effect (like a "red out" indicating pain) and/or make a sound effect ("Ouch!" or "Thud!" or such sounds). You can look at FallHeight parameter, given to the callback, e.g. to gauge how much health decreases. |
![]() |
property IgnoreAllInputs: boolean
read GetIgnoreAllInputs write SetIgnoreAllInputs default false; deprecated; |
Warning: this symbol is deprecated.
Deprecated, use more flexible Input instead. |
![]() |
property Frustum: TFrustum read GetFrustum; deprecated 'use Viewport.Camera.Frustum'; |
Warning: this symbol is deprecated: use Viewport.Camera.Frustum The current camera viewing frustum, based on ProjectionMatrix (set by the outside) and Matrix (calculated here). This is recalculated whenever one of these two properties change. Be sure to set ProjectionMatrix before using this. |
![]() |
property ProjectionMatrix: TMatrix4
read GetProjectionMatrix write SetProjectionMatrix; deprecated 'use Viewport.Camera.ProjectionMatrix'; |
Warning: this symbol is deprecated: use Viewport.Camera.ProjectionMatrix Projection matrix of the camera. Camera needs to know this to calculate Frustum, which in turn allows rendering code to use frustum culling. In normal circumstances, if you use TCastleViewport for rendering, this is automatically correctly set. |
![]() |
property Radius: Single read FRadius write SetRadius default DefaultRadius; |
The radius of a sphere around the camera that makes collisions with the world.
|
![]() |
property Position : TVector3 read GetPosition write SetPosition; deprecated 'use Viewport.Camera.Position'; |
Warning: this symbol is deprecated: use Viewport.Camera.Position Camera position, looking direction and up vector. Initially (after creating this object) they are equal to InitialPosition, InitialDirection, InitialUp. Also GoToInitial methods reset them to these initial values. The Direction and Up vectors should always be normalized (have length 1). When setting them by these properties, we will normalize them automatically, so their given length is actually ignored. When setting Direction, Up will always be automatically adjusted to be orthogonal to Direction. And vice versa — when setting Up, Direction will be adjusted. |
![]() |
property Direction: TVector3 read GetDirection write SetDirection; deprecated 'use Viewport.Camera.Direction'; |
Warning: this symbol is deprecated: use Viewport.Camera.Direction |
![]() |
property Up : TVector3 read GetUp write SetUp; deprecated 'use Viewport.Camera.Up'; |
Warning: this symbol is deprecated: use Viewport.Camera.Up |
![]() |
property GravityUp: TVector3 read GetGravityUp write SetGravityUp; deprecated 'use Viewport.Camera.GravityUp'; |
Warning: this symbol is deprecated: use Viewport.Camera.GravityUp "Up" direction of the world in which player moves. Always normalized (when setting this property, we take care to normalize the provided vector). This determines in which direction TCastleWalkNavigation.Gravity works. This is also the "normal" value for both Up and InitialUp — one that means that player is looking straight foward. This is used for features like PreferGravityUpForRotations and/or PreferGravityUpForMoving. The default value of this vector is (0, 1, 0) (same as the default Up and InitialUp vectors). |
![]() |
property PreferredHeight: Single
read FPreferredHeight write FPreferredHeight default DefaultPreferredHeight; |
Height above the ground, only used by TCastleWalkNavigation descendant when TCastleWalkNavigation.Gravity is This must always be >= 0. You should set this to something greater than zero to get sensible behavior of some things related to TCastleWalkNavigation.Gravity. See CorrectPreferredHeight for important property of |
![]() |
property CrouchHeight: Single
read FCrouchHeight write FCrouchHeight default DefaultCrouchHeight; |
Preferred height when crouching. This is always mutiplied to PreferredHeight. This should always be <= 1 ( |
![]() |
property HeadBobbing: Single
read FHeadBobbing write FHeadBobbing default DefaultHeadBobbing; |
When TCastleWalkNavigation moves, it may make a "head bobbing" effect, by moving the camera a bit up and down. This property mutiplied by PreferredHeight says how much head bobbing can move you along GravityUp. Set this to 0 to disable head bobbing. This must always be < 1.0. For sensible effects, this should be rather close to 0.0, for example 0.02. This is meaningfull only when TCastleWalkNavigation.Gravity works. |
![]() |
property HeadBobbingTime: Single
read FHeadBobbingTime write FHeadBobbingTime
default DefaultHeadBobbingTime; |
Controls head bobbing frequency. In the time of Note that if you do a footsteps sound in your game (see stPlayerFootstepsDefault or TMaterialProperty.FootstepsSound) then you will want this property to match your footsteps sound length, things feel and sound natural then. Also, often it sounds better to record two footsteps inside a single sound file, in which case the footstep sound length should be twice as long as this property. For example, record 2 steps inside a 1-second long footstep sound, and set this property to 0.5 a second (which is a default in fact). |
![]() |
property MoveHorizontalSpeed: Single
read FMoveHorizontalSpeed write FMoveHorizontalSpeed default 1.0; |
Moving speeds, only used by TCastleWalkNavigation descendant. We move by distance Default values for all these speed properties is 1.0, so you simply move by 1 unit per second. |
![]() |
property MoveVerticalSpeed: Single
read FMoveVerticalSpeed write FMoveVerticalSpeed default 1.0; |
![]() |
property MoveSpeed: Single read FMoveSpeed write FMoveSpeed default 1.0; |
![]() |
property ClimbHeight: Single read FClimbHeight write FClimbHeight; |
The tallest height that you can climb, only used by TCastleWalkNavigation descendant when TCastleWalkNavigation.Gravity is This is reliable to prevent user from climbing stairs and such, when vertical walls are really vertical (not just steep-almost-vertical). It's not 100% reliable to prevent player from climbing steep hills. That's because, depending on how often an event processing occurs, you actually climb using less or more steps. So even a very steep hill can be always climbed on a computer with very fast speed, because with large FPS you effectively climb it using a lot of very small steps (assuming that FPS limit is not enabled, that is CastleWindow.TCastleApplication.LimitFPS or CastleControl.LimitFPS is zero). Remember that user can still try jumping to climb on high obstactes. See TCastleWalkNavigation.JumpMaxHeight for a way to control jumping. For a 100% reliable way to prevent user from reaching some point, that does not rely on specific navigation settings, you should build actual walls in 3D (invisible walls can be created by Collision.proxy in VRML/X3D). |
![]() |
property ModelBox: TBox3D read FModelBox write SetModelBox; |
Approximate size of 3D world that is viewed, used by TCastleExamineNavigation descendant. Determines speed of movement and zooming. Initially this is TBox3D.Empty. |
![]() |
property Input: TNavigationInputs read FInput write SetInput default DefaultInput; |
Input methods available to user. See documentation of TNavigationInput type for possible values and their meaning. To disable any user interaction with this navigation you can simply set this to empty. You can also leave TCastleViewport.Navigation as |
![]() |
property FullSize default true; |
By default this captures events from whole parent, which should be whole Viewport. |
Generated by PasDoc 0.16.0.