Class TCastleAutoNavigationViewport

Unit

Declaration

type TCastleAutoNavigationViewport = class(TCastleViewport)

Description

Warning: this symbol is deprecated: use TCastleViewport instead of this; it is more straightforward to create TCastleNavigation explicitly (rather than auto-detecting it) and just add it as TCastleViewport child

Automatically create and switch between various navigation classes on a viewport.

We don't advise using this class – usually it is more straightforward to just explicitly create own instances of classes like TCastleExamineNavigation, TCastleWalkNavigation, add them as TCastleViewport children, control which one is used by TCastleUserInterface.Exists.

This class allows more implicit management of current navigation type. Navigation can be adjusted using

Hierarchy

Overview

Methods

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected procedure BoundNavigationInfoChanged; override;
Public function RequiredNavigation: TCastleNavigation;
Public function WalkNavigation(const SwitchNavigationTypeIfNeeded: boolean = true): TCastleWalkNavigation;
Public function ExamineNavigation(const SwitchNavigationTypeIfNeeded: boolean = true): TCastleExamineNavigation;
Public function InternalExamineNavigation: TCastleExamineNavigation;
Public function InternalWalkNavigation: TCastleWalkNavigation;
Public procedure AssignDefaultNavigation; virtual;
Public class function InternalGetNavigationType(const V: TCastleViewport): TNavigationType;

Properties

Public property NavigationType: TNavigationType read GetNavigationType write SetNavigationType default ntNone;
Published property AutoNavigation: Boolean read FAutoNavigation write SetAutoNavigation default false;

Description

Methods

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;

This item has no description.

Protected procedure BoundNavigationInfoChanged; override;

This item has no description.

Public function RequiredNavigation: TCastleNavigation;

Return current navigation. Automatically creates it if missing.

Public function WalkNavigation(const SwitchNavigationTypeIfNeeded: boolean = true): TCastleWalkNavigation;

Return the currently used navigation as TCastleWalkNavigation, making sure that current NavigationType is something using TCastleWalkNavigation.

Public function ExamineNavigation(const SwitchNavigationTypeIfNeeded: boolean = true): TCastleExamineNavigation;

Return the currently used navigation as TCastleExamineNavigation, making sure that current NavigationType is something using TCastleExamineNavigation.

Public function InternalExamineNavigation: TCastleExamineNavigation;

Warning: this symbol is deprecated.

Navigation instances internally used by this viewport. Using these methods automatically creates these instances (so they are never Nil).

Using these methods does not make these navigation instances current (in contast to calling ExamineNavigation, WalkNavigation or setting NavigationType).

When you switch navigation types by calling ExamineNavigation, WalkNavigation or setting NavigationType the viewport keeps using these instances of navigation, instead of creating new navigation instances. This way all the navigation properties are preserved when you switch e.g. NavigationType from ntWalk to ntExamine to ntWalk again.

This is deprecated now, because it causes auto-detection of navigation parameters, which is (in general) more surprising than helpful. E.g. it adjusts navigation radius, speed and more properties.

Public function InternalWalkNavigation: TCastleWalkNavigation;

This item has no description.

Public procedure AssignDefaultNavigation; virtual;

Assign Navigation to a default TCastleNavigation suitable for navigating in this scene.

This is automatically used when Navigation is Nil and AutoNavigation. You can also use it explicitly.

The implementation in base TCastleViewport uses TNavigationInfoNode from MainScene. If MainScene is not assigned, we create a simple navigation in Examine mode.

Public class function InternalGetNavigationType(const V: TCastleViewport): TNavigationType;

This item has no description.

Properties

Public property NavigationType: TNavigationType read GetNavigationType write SetNavigationType default ntNone;

Set Navigation and some of its' parameters (like TCastleWalkNavigation.Gravity and so on).

If AutoNavigation, the initial Navigation as well as initial value of this property are automatically determined by the currently bound X3D NavigatinInfo node in the MainScene, and world bounding box. They are also automatically adjusted e.g. when current NavigatinInfo node changes.

But you can set Navigation, or this property, manually to override the detected navigation. You should set AutoNavigation to False to take control of Navigation and this property completely (no auto-detection based on MainScene will then take place).

Note that you can also affect the current NavigationType by directly changing the camera properties, e.g. you can directly change TCastleWalkNavigation.Gravity from False to True, and thus you effectively switch from ntFly to ntWalk navigation types. When you read the NavigationType property, we determine the current navigation type from current camera properties.

Setting this sets:

If you write to NavigationType, then you should not touch the above properties directly. That's because not every combination of above properties correspond to some sensible value of NavigationType. If you directly set some weird configuration, reading NavigationType will try it's best to determine the closest TNavigationType value that is similar to your configuration.

Published property AutoNavigation: Boolean read FAutoNavigation write SetAutoNavigation default false;

Assign sensible Navigation looking at the initial world (Items) if it is not assigned.

This also allows to later synchronize navigation properties when X3D NavigationInfo node changes, or a new NavigationInfo node is bound.

By default it is False, which means that you control Navigation on your own.


Generated by PasDoc 0.16.0.