Class TCastleScene

Unit

Declaration

type TCastleScene = class(TCastleSceneCore)

Description

Complete loading, processing and rendering of a scene. This is a descendant of TCastleSceneCore that adds efficient rendering.

Source: scene/castlescene.pas (line 123).

Hierarchy

Show Additional Members:

Overview

Nested Classes and Records

Protected TVisibilitySensors = class(specialize TDictionary<TVisibilitySensorNode,TVisibilitySensorInstanceList>)

Nested Types

Protected TVisibilitySensorInstanceList = specialize TObjectList<TVisibilitySensorInstance>;

Constants

Public DefaultMiddleHeight = 0.5;
Public DefaultDirection: array [TOrientationType] of TVector3 = ( (X: 0; Y: 0; Z: -1), (X: 0; Y: 0; Z: +1), (X: 0; Y: -1; Z: 0), (X: 1; Y: 0; Z: 0) );
Public DefaultUp: array [TOrientationType] of TVector3 = ( (X: 0; Y: 1; Z: 0), (X: 0; Y: 1; Z: 0), (X: 0; Y: 0; Z: 1), (X: 0; Y: 0; Z: 1) );
Public DefaultCameraOrientation = otUpYDirectionMinusZ;
Public DefaultShadowMapsDefaultSize = 256;

Fields

Public class var DefaultOrientation: TOrientationType;
Public InternalExcludeFromParentBoundingVolume: Boolean;
Protected ScreenEffectNodes: TX3DNodeList;
Protected IsVisibleNow: boolean;
Protected GeneratedTextures: TGeneratedTextureList;

Methods

Protected function GetInternalText: String; virtual;
Protected procedure SetInternalText(const Value: String); virtual;
Protected procedure SetName(const Value: TComponentName); override;
Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); virtual;
Public procedure SetTransient;
Public procedure AddNonVisualComponent(const NonVisualComponent: TComponent);
Public procedure InsertNonVisualComponent(const Index: Integer; const NonVisualComponent: TComponent);
Public procedure RemoveNonVisualComponent(const NonVisualComponent: TComponent);
Public function NonVisualComponentsIndexOf(const NonVisualComponent: TComponent): Integer;
Public function NonVisualComponentsCount: Integer;
Public function NonVisualComponentsEnumerate: TNonVisualComponentsEnumerator;
Public function ValueIsStreamed: Boolean; virtual;
Public procedure DesignerInfo(const SList: TStrings); virtual;
Protected function GetRenderList(const Params: TRenderParams): TCastleTransformList; virtual;
Protected procedure RegisterGLContextClose;
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected function HeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean;
Protected function MoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; overload;
Protected function MoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; overload;
Protected function SegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean;
Protected function SphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;
Protected function SphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails = nil): boolean;
Protected function PointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;
Protected function BoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;
Protected function RayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision;
Protected function Translation2D: TVector2; deprecated 'use TranslationXY';
Protected procedure TransformMatricesMult(var M, MInverse: TMatrix4); deprecated 'do not use this directly, instead use Transform and InverseTransform methods';
Protected procedure TransformMatrices(out M, MInverse: TMatrix4); deprecated 'do not use this directly, instead use Transform and InverseTransform methods';
Protected function AverageScale: Single;
Protected function AverageScale2D: Single;
Protected procedure Fall(const FallHeight: Single); virtual;
Protected procedure ExistsInRootChanged; virtual;
Public procedure DesignerWarnings(const SList: TStrings); override;
Public function GetEnumerator: TEnumerator;
Public function CheckCollides: Boolean;
Public function GetCollides: boolean; virtual; deprecated 'use CheckCollides';
Public function CheckPickable: boolean;
Public function GetPickable: boolean; virtual; deprecated 'use CheckPickable';
Public function CheckVisible: boolean;
Public function GetVisible: boolean; virtual; deprecated 'use CheckVisible';
Public procedure Add(const Item: TCastleTransform);
Public procedure Insert(const Index: Integer; const Item: TCastleTransform);
Public procedure Remove(const Item: TCastleTransform);
Public procedure RemoveDelayed(const Item: TCastleTransform; const FreeItem: Boolean = false);
Public procedure Delete(const Index: Integer);
Public function Count: Integer;
Public procedure Clear;
Public procedure Exchange(const Index1, Index2: Integer);
Public function BoundingBox: TBox3D;
Public function WorldBoundingBox: TBox3D;
Public procedure Render(const Params: TRenderParams); overload; virtual;
Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); overload; deprecated 'use Render method without an explicit Frustum parameter, it is in Params.Frustum now';
Public procedure RenderShadowVolume(const Params: TRenderParams; const ShadowVolumeRenderer: TBaseShadowVolumeRenderer);
Public procedure AddAfterUpdateListener(const UpdateListener: TNotifyEvent);
Public procedure RemoveAfterUpdateListener(const UpdateListener: TNotifyEvent);
Public procedure VisibleChangeHere(const Changes: TVisibleChanges); virtual;
Public function Middle: TVector3; virtual;
Public function WorldMiddle: TVector3;
Public function Sphere(out Radius: Single): boolean; virtual;
Public function Height(const MyPosition: TVector3; out AboveHeight: Single): boolean; overload;
Public function Height(const MyPosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; overload;
Public function LineOfSight(const Pos1, Pos2: TVector3): boolean;
Public function MoveAllowed(const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const BecauseOfGravity: boolean): boolean; overload;
Public function MoveAllowed(const OldPos, NewPos: TVector3; const BecauseOfGravity: boolean): boolean; overload;
Public function Ray(const RayOrigin, RayDirection: TVector3): TRayCollision;
Public function RayCast(const RayOrigin, RayDirection: TVector3): TCastleTransform; overload;
Public function RayCast(const RayOrigin, RayDirection: TVector3; out Distance: Single): TCastleTransform; overload;
Public function OutsideToLocal(const Pos: TVector3): TVector3;
Public function LocalToOutside(const Pos: TVector3): TVector3;
Public function WorldToLocal(const Pos: TVector3): TVector3;
Public function LocalToWorld(const Pos: TVector3): TVector3;
Public function WorldToLocalDirection(const Dir: TVector3): TVector3;
Public function LocalToWorldDirection(const Dir: TVector3): TVector3;
Public function LocalToWorldDistance(const Distance: Single): Single;
Public function WorldToLocalDistance(const Distance: Single): Single;
Public function PreferredHeight: Single; virtual; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';
Public function Transform: TMatrix4;
Public function InverseTransform: TMatrix4;
Public function HasWorldTransform: boolean;
Public function WorldTransform: TMatrix4;
Public function WorldInverseTransform: TMatrix4;
Public procedure Translate(const TranslationChange: TVector3);
Public function Move(const TranslationChange: TVector3; const BecauseOfGravity: boolean; const EnableWallSliding: boolean = true): boolean;
Public procedure Identity;
Public procedure GetView(out APos, ADir, AUp: TVector3);
Public procedure GetWorldView(out APos, ADir, AUp: TVector3);
Public function WorldTranslation: TVector3;
Public procedure SetView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true); overload;
Public procedure SetView(const ADir, AUp: TVector3; const AdjustUp: boolean = true); overload;
Public procedure SetWorldView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true);
Public procedure UpPrefer(const AUp: TVector3);
Public procedure AddBehavior(const Behavior: TCastleBehavior);
Public procedure InsertBehavior(const Index: Integer; const Behavior: TCastleBehavior);
Public function BehaviorIndex(const Behavior: TCastleBehavior): Integer;
Public procedure RemoveBehavior(const Behavior: TCastleBehavior);
Public function FindBehavior(const BehaviorClass: TCastleBehaviorClass): TCastleBehavior;
Public function FindAllBehaviors(const BehaviorClass: TCastleBehaviorClass): TCastleBehaviorList;
Public function FindRequiredBehavior(const BehaviorClass: TCastleBehaviorClass): TCastleBehavior;
Public function BehaviorsCount: Integer;
Public function BehaviorsEnumerate: TCastleBehaviorEnumerator;
Public procedure AddWorldChangeNotification(const Behavior: TCastleBehavior);
Public procedure RemoveWorldChangeNotification(const Behavior: TCastleBehavior);
Public function InternalBuildNode: TObject;
Protected procedure ExecuteCompiledScript(const HandlerName: string; ReceivedValue: TX3DField); virtual; abstract;
Public procedure InternalChangedField(const Field: TX3DField; const Change: TX3DChange); overload; virtual; abstract;
Public procedure InternalChangedField(const Field: TX3DField); overload;
Public function InternalCastingShadowVolumesNow: Boolean; virtual; abstract;
Protected function InternalBuildNodeInside: TObject; override;
Protected procedure UpdateHeadlightOnFromNavigationInfo;
Protected procedure ChangedTransform; override;
Protected procedure DoPointingDeviceSensorsChange; virtual;
Protected procedure ExecuteCompiledScript(const HandlerName: String; ReceivedValue: TX3DField); override;
Protected function LocalHeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override;
Protected function LocalMoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;
Protected function LocalMoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;
Protected function LocalSegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override;
Protected function LocalSphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;
Protected function LocalSphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails): boolean; override;
Protected function LocalPointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;
Protected function LocalBoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;
Protected function LocalRayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision; override;
Protected procedure Loaded; override;
Protected procedure InternalMoveShapeAssociations( const OldNode, NewNode: TX3DNode; const ContainingShapes: TObject); override;
Protected function LocalBoundingBoxNoChildren: TBox3D;
Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override;
Public procedure Load(const ARootNode: TX3DRootNode; const AOwnsRootNode: boolean; const AOptions: TSceneLoadOptions = []); overload;
Public procedure Load(const AUrl: String; const AOptions: TSceneLoadOptions = []); overload;
Public procedure Load(const AUrl: String; const AllowStdIn: boolean; const AResetTime: boolean = true); overload; deprecated 'use Load with (AUrl: String, AOptions: TSceneLoadOptions) parameters. AllowStdIn is not implemented anymore.';
Public procedure Save(const AUrl: String);
Public procedure BeforeDestruction; override;
Public function ShapeBoundingBox(const Node: TAbstractShapeNode): TBox3D;
Public function ShapesActiveCount: Cardinal;
Public function ShapesActiveVisibleCount: Cardinal;
Public function VerticesCount: Cardinal; overload;
Public function TrianglesCount: Cardinal; overload;
Public function ViewpointsCount: Cardinal;
Public function GetViewpointNode(const Idx: integer): TAbstractViewpointNode;
Public function GetViewpointName(const Idx: integer): String;
Public procedure MoveToViewpoint(const Idx: integer; const Animated: boolean = true);
Public procedure AddViewpointFromNavigation(const Navigation: TCastleNavigation; const AName: String);
Public procedure NodeFreeRemovingFromAllParents(Node: TX3DNode);
Public procedure RemoveShape(Shape: TShape);
Public procedure ChangedAll(const OnlyAdditions: Boolean = false); override;
Public procedure DoViewpointsChanged;
Public procedure DoBoundViewpointVectorsChanged;
Public procedure DoBoundNavigationInfoFieldsChanged; virtual;
Public procedure ScheduleChangedAll(const OnlyAdditions: Boolean = false);
Public procedure BeginChangesSchedule;
Public procedure EndChangesSchedule;
Public function Info( ATriangleVerticesCounts, ABoundingBox: boolean; AManifoldAndBorderEdges: boolean): String; deprecated 'do not use this, better to construct a summary string yourself';
Public function InfoTriangleVerticesCounts: String; deprecated 'better to construct a string yourself, use TrianglesCount, VerticesCount';
Public function InfoBoundingBox: String; deprecated 'better to construct a string yourself, use BoundingBox.ToString';
Public function InfoManifoldAndBorderEdges: String; deprecated 'better to construct a string yourself, use EdgesCount';
Public function InternalDetectedWholeSceneManifold( const ForceRecalculation: Boolean = false): Boolean;
Public procedure EdgesCount(out ManifoldEdges, BorderEdges: Cardinal);
Public function InternalOctreeRendering: TShapeOctree;
Public function InternalOctreeDynamicCollisions: TShapeOctree;
Public function InternalOctreeCollisions: TBaseTrianglesOctree;
Public function UseInternalOctreeCollisions: boolean;
Public function GetViewpoint( out ProjectionType: TProjectionType; out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: String = ''): TAbstractViewpointNode;
Public function GetPerspectiveViewpoint( out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: String = ''): TAbstractViewpointNode;
Public procedure UnregisterScene(Node: TX3DNode); deprecated 'use Node.UnregisterScene';
Public function Press(const Event: TInputPressRelease): boolean; override;
Public function Release(const Event: TInputPressRelease): boolean; override;
Public function PointingDevicePress(const Pick: TRayCollisionNode; const Distance: Single): Boolean; override;
Public function PointingDeviceRelease(const Pick: TRayCollisionNode; const Distance: Single; const CancelAction: Boolean): Boolean; override;
Public function PointingDeviceMove(const Pick: TRayCollisionNode; const Distance: Single): boolean; override;
Public function PointingDeviceSensors: TPointingDeviceSensorList;
Public procedure PointingDeviceClear;
Public function LocalBoundingBox: TBox3D; override;
Public procedure SetTime(const NewValue: TFloatTime);
Public procedure IncreaseTime(const TimeIncrease: TFloatTime);
Public procedure IncreaseTimeTick; deprecated 'it should not be necessary to call this, ever; using TX3DEvent.Send(...) or TX3DEvent.Send(..., NextEventTime) will automatically behave Ok.';
Public function Time: TFloatTime; override;
Public function NextEventTime: TX3DTime; override;
Public procedure ResetTime(const NewValue: TFloatTime);
Public procedure ResetTimeAtLoad;
Public function GetBackgroundStack: TX3DBindableStackBasic; override;
Public function GetFogStack: TX3DBindableStackBasic; override;
Public function GetNavigationInfoStack: TX3DBindableStackBasic; override;
Public function GetViewpointStack: TX3DBindableStackBasic; override;
Public procedure RegisterCompiledScript(const HandlerName: String; Handler: TCompiledScriptHandler);
Public procedure InternalUpdateNavigation( const Navigation: TCastleNavigation);
Public procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';
Public procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';
Public procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';
Public procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';
Public function CustomHeadlight: TAbstractLightNode;
Public function Caption: String;
Public function Node(const NodeClass: TX3DNodeClass; const NodeName: String; const Options: TFindNodeOptions = []): TX3DNode; overload;
Public function Node(const NodeName: String): TX3DNode; overload;
Public function Field(const NodeName, FieldName: String): TX3DField; overload;
Public function Event(const NodeName, EventName: String): TX3DEvent; overload;
Public function HasAnimation(const AnimationName: String): boolean;
Public function AnimationTimeSensor(const AnimationName: String): TTimeSensorNode; overload;
Public function AnimationTimeSensor(const Index: Integer): TTimeSensorNode; overload;
Public function ForceAnimationPose(const AnimationName: String; const TimeInAnimation: TFloatTime; const Loop: boolean; const Forward: boolean = true): boolean; overload;
Public function PlayAnimation(const Parameters: TPlayAnimationParameters): boolean; overload;
Public function PlayAnimation(const AnimationName: String; const Loop: boolean; const Forward: boolean = true): boolean; overload;
Public procedure ForceInitialAnimationPose;
Public function AnimationDuration(const AnimationName: String): TFloatTime;
Public procedure StopAnimation(const DisableStopNotification: Boolean = false);
Public procedure ResetAnimationState(const IgnoreAffectedBy: TTimeSensorNode = nil);
Public procedure FontChanged;
Public procedure InternalIncShapesHash;
Public procedure ReloadUrl;
Protected function EffectiveRenderOptions: TCastleRenderOptions; override;
Protected function CreateShape(const AGeometry: TAbstractGeometryNode; const AState: TX3DGraphTraverseState; const ParentInfo: PTraversingInfo): TShape; override;
Protected procedure LocalRender(const Params: TRenderParams); override;
Protected procedure LocalRenderShadowVolume(const Params: TRenderParams; const ShadowVolumeRenderer: TBaseShadowVolumeRenderer); override;
Protected procedure ChangeWorld(const Value: TCastleAbstractRootTransform); override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public procedure GLContextClose; override;
Public procedure PrepareResources(const Options: TPrepareResourcesOptions; const Params: TPrepareParams); override; deprecated 'this is internal; use TCastleViewport.PrepareResources to prepare transformations';
Public procedure BeforeNodesFree(const InternalChangedAll: boolean = false); override;
Public function HasColliderMesh: Boolean; override;
Public procedure ColliderMesh(const TriangleEvent: TTriangleEvent); override;
Public procedure FreeResources(Resources: TSceneFreeResources); override;
Public function Clone(const AOwner: TComponent): TCastleScene;
Public function WasVisible: Boolean;
Public procedure SetEffects(const Value: array of TEffectNode);

Properties

Public property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents;
Public property IsLoading: Boolean read FIsLoading;
Public property GetExists: Boolean read FExists; deprecated 'use Exists';
Public property Items[const I: Integer]: TCastleTransform read GetItem write SetItem; default;
Public property Parent: TCastleTransform read FParent write SetParent;
Public property UniqueParent: TCastleTransform read FParent; deprecated 'use Parent';
Public property CastShadowVolumes: boolean read FCastShadows write FCastShadows default true; deprecated 'use CastShadows';
Public property ListenPressRelease: Boolean read FListenPressRelease write SetListenPressRelease default false;
Public property World: TCastleAbstractRootTransform read FWorld;
Public property WorldDirection: TVector3 read GetWorldDirection write SetWorldDirection;
Public property CollidesWithMoving: boolean read FCollidesWithMoving write FCollidesWithMoving default false;
Public property Gravity: boolean read FGravity write FGravity default false; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';
Public property FallSpeed: Single read FFallSpeed write FFallSpeed default 0; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';
Public property GrowSpeed: Single read FGrowSpeed write FGrowSpeed default 0; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';
Public property MiddleHeight: Single read FMiddleHeight write FMiddleHeight default DefaultMiddleHeight;
Public property Translation: TVector3 read FTranslation write SetTranslation;
Public property TranslationXY: TVector2 read GetTranslationXY write SetTranslationXY;
Public property Center: TVector3 read FCenter write SetCenter;
Public property Rotation: TVector4 read FRotation write SetRotation;
Public property Scale: TVector3 read FScale write SetScale;
Public property ScaleOrientation: TVector4 read FScaleOrientation write SetScaleOrientation;
Public property RigidBody: TCastleRigidBody read FCachedRigidBody;
Public property Collider: TCastleCollider read FCachedCollider;
Public property Position: TVector3 read FTranslation write SetTranslation; deprecated 'use Translation';
Public property Direction: TVector3 read GetDirection write SetDirection;
Public property Up: TVector3 read GetUp write SetUp;
Public property WorldView: TViewVectors read GetWorldViewRec write SetWorldViewRec;
Public property Orientation: TOrientationType read FOrientation write FOrientation;
Public property List: TCastleTransformList read FList;
Public property Behaviors [const Index: Integer]: TCastleBehavior read GetBehaviors;
Public property ExistsInRoot: Boolean read FExistsInRoot;
Published property Exists: Boolean read FExists write SetExists default true;
Published property Collides: boolean read FCollides write FCollides default true;
Published property Pickable: boolean read FPickable write FPickable default true;
Published property Visible: boolean read FVisible write FVisible default true;
Published property CollisionSphereRadius: Single read FCollisionSphereRadius write FCollisionSphereRadius;
Published property CastShadows: boolean read FCastShadows write FCastShadows default true;
Published property RenderLayer: TRenderLayer read FRenderLayer write FRenderLayer default rlParent;
Published property CenterPersistent: TCastleVector3Persistent read FCenterPersistent ;
Published property RotationPersistent: TCastleVector4RotationPersistent read FRotationPersistent ;
Published property ScalePersistent: TCastleVector3Persistent read FScalePersistent ;
Published property ScaleOrientationPersistent: TCastleVector4Persistent read FScaleOrientationPersistent ;
Published property TranslationPersistent: TCastleVector3Persistent read FTranslationPersistent ;
Published property DirectionPersistent: TCastleVector3Persistent read FDirectionPersistent stored false;
Published property UpPersistent: TCastleVector3Persistent read FUpPersistent stored false;
Protected property VisibilitySensors: TVisibilitySensors read FVisibilitySensors;
Public property Shapes: TShapeTree read FShapes;
Public property OnGeometryChanged: TSceneGeometryChanged read FOnGeometryChanged write FOnGeometryChanged;
Public property OnViewpointsChanged: TNotifyEvent read FOnViewpointsChanged write FOnViewpointsChanged;
Public property OnBoundViewpointVectorsChanged: TNotifyEvent read FOnBoundViewpointVectorsChanged write FOnBoundViewpointVectorsChanged;
Public property OnBoundNavigationInfoFieldsChanged: TNotifyEvent read FOnBoundNavigationInfoFieldsChanged write FOnBoundNavigationInfoFieldsChanged;
Public property RootNode: TX3DRootNode read FRootNode write SetRootNode;
Public property OwnsRootNode: boolean read FOwnsRootNode write FOwnsRootNode default true; deprecated 'set OwnsRootNode only at loading, do not depend on this property';
Public property PointingDeviceOverItem: PTriangle read FPointingDeviceOverItem write FPointingDeviceOverItem;
Public property PointingDeviceOverPoint: TVector3 read FPointingDeviceOverPoint write FPointingDeviceOverPoint;
Public property PointingDeviceActiveSensors: TX3DNodeList read FPointingDeviceActiveSensors;
Public property PointingDeviceActive: boolean read FPointingDeviceActive default false;
Public property OnPointingDeviceSensorsChange: TNotifyEvent read FOnPointingDeviceSensorsChange write FOnPointingDeviceSensorsChange;
Public property TimeAtLoad: TFloatTime read FTimeAtLoad;
Public property BackgroundStack: TBackgroundStack read FBackgroundStack;
Public property FogStack: TFogStack read FFogStack;
Public property NavigationInfoStack: TNavigationInfoStack read FNavigationInfoStack;
Public property ViewpointStack: TViewpointStack read FViewpointStack;
Public property CompiledScriptHandlers: TCompiledScriptHandlerInfoList read FCompiledScriptHandlers;
Public property HeadlightOn: boolean read FHeadlightOn write SetHeadlightOn;
Public property OnHeadlightOnChanged: TNotifyEvent read FOnHeadlightOnChanged write FOnHeadlightOnChanged;
Public property InternalGlobalLights: TLightInstancesList read FGlobalLights;
Public property AnimationsList: TStrings read FAnimationsList;
Public property AnimationPrefix: String read FAnimationPrefix write FAnimationPrefix; deprecated 'this property did not prove to be of much use; report if you need it, otherwise it may be removed one day';
Public property CurrentAnimation: TTimeSensorNode read FCurrentAnimation;
Public property FileName: String read FUrl write SetUrl; deprecated;
Public property InternalShapesHash: TShapesHash read FShapesHash;
Published property DefaultAnimationTransition: Single read FDefaultAnimationTransition write FDefaultAnimationTransition default 0.0;
Published property TimePlaying: boolean read FTimePlaying write FTimePlaying default true;
Published property TimePlayingSpeed: Single read FTimePlayingSpeed write FTimePlayingSpeed default 1.0;
Published property PreciseCollisions: Boolean read FPreciseCollisions write SetPreciseCollisions default false;
Published property ProcessEvents: boolean read FProcessEvents write SetProcessEvents default false;
Published property Url: String read FUrl write SetUrl;
Published property ShadowMaps: boolean read FShadowMaps write SetShadowMaps default true;
Published property ShadowMapsDefaultSize: Cardinal read FShadowMapsDefaultSize write SetShadowMapsDefaultSize default DefaultShadowMapsDefaultSize;
Published property InitialViewpointIndex: Cardinal read FInitialViewpointIndex write FInitialViewpointIndex default 0;
Published property InitialViewpointName: String read FInitialViewpointName write FInitialViewpointName;
Published property AnimateOnlyWhenVisible: boolean read FAnimateOnlyWhenVisible write FAnimateOnlyWhenVisible default false;
Published property AnimateSkipTicks: Cardinal read FAnimateSkipTicks write SetAnimateSkipTicks default 0;
Published property AutoAnimation: String read FAutoAnimation write SetAutoAnimation;
Published property AutoAnimationLoop: Boolean read FAutoAnimationLoop write SetAutoAnimationLoop default true; deprecated 'in future engine versions, AutoAnimationLoop may behave as always = true, and AutoAnimation will be renamed to just Animation and changing it will always cause a looping animation. Use PlayAnimation(''my_anim'',false) from code to play animation without looping.';
Published property ExposeTransforms: TStrings read FExposeTransforms write SetExposeTransforms;
Published property ExposeTransformsPrefix: String read FExposeTransformsPrefix write SetExposeTransformsPrefix;
Published property Cache: Boolean read FCache write FCache default false;
Published property ShapeFrustumCulling: Boolean read FShapeFrustumCulling write SetShapeFrustumCulling default true;
Published property SceneFrustumCulling: Boolean read FSceneFrustumCulling write FSceneFrustumCulling default true;
Published property ReceiveShadowVolumes: boolean read FReceiveShadowVolumes write FReceiveShadowVolumes default true;
Published property DistanceCulling: Single read FDistanceCulling write SetDistanceCulling default 0;
Published property RenderOptions: TCastleRenderOptions read FRenderOptions;
Published property CastGlobalLights: Boolean read FCastGlobalLights write SetCastGlobalLights default false;
Published property TransformOptimization: TTransformOptimization read FTransformOptimization write FTransformOptimization default toAutomatic;

Description

Nested Types

Protected TVisibilitySensorInstanceList = specialize TObjectList<TVisibilitySensorInstance>;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 447).

Constants

Public DefaultMiddleHeight = 0.5;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 626).

Public DefaultDirection: array [TOrientationType] of TVector3 = ( (X: 0; Y: 0; Z: -1), (X: 0; Y: 0; Z: +1), (X: 0; Y: -1; Z: 0), (X: 1; Y: 0; Z: 0) );

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 627).

Public DefaultUp: array [TOrientationType] of TVector3 = ( (X: 0; Y: 1; Z: 0), (X: 0; Y: 1; Z: 0), (X: 0; Y: 0; Z: 1), (X: 0; Y: 0; Z: 1) );

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 633).

Public DefaultCameraOrientation = otUpYDirectionMinusZ;

This item is declared in ancestor TCastleTransform.

Default TCastleCamera.Orientation.

Source: transform/castletransform_transform.inc (line 641).

Public DefaultShadowMapsDefaultSize = 256;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 960).

Fields

Public class var DefaultOrientation: TOrientationType;

This item is declared in ancestor TCastleTransform.

Default value of TCastleTransform.Orientation for new TCastleTransform instances, except for cameras (cameras use special DefaultCameraOrientation).

This is otUpYDirectionZ by default. This matches glTF orientation (as exported from Blender and other software).

Source: transform/castletransform_transform.inc (line 649).

Public InternalExcludeFromParentBoundingVolume: Boolean;

This item is declared in ancestor TCastleTransform.

Exclude this object's bounding volume from parent bounding volume.

This should be always False for non-debug scenes. Changing this may cause rendering artifacts, things could disappear when they should not. Using this is reasonable only if you attach a debug geometry to your scene, and you don't want to enlarge your bounding volume (e.g. because this debug geometry visualizes something determined by the bounding volume, and it would create a "feedback loop" if the visualization itself would enlarge the bounding box).

Source: transform/castletransform_transform.inc (line 699).

Protected ScreenEffectNodes: TX3DNodeList;

This item is declared in ancestor TCastleSceneCore.

List of TScreenEffectNode nodes, collected by ChangedAll.

Source: scene/castlescenecore.pas (line 839).

Protected IsVisibleNow: boolean;

This item is declared in ancestor TCastleSceneCore.

Is the scene visible currently. Descendants may set this to True during TCastleTransform.LocalRender.

Source: scene/castlescenecore.pas (line 843).

Protected GeneratedTextures: TGeneratedTextureList;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 845).

Methods

Protected function GetInternalText: String; virtual;

This item is declared in ancestor TCastleComponent.

This item has no description.

Source: base/castleclassutils.pas (line 575).

Protected procedure SetInternalText(const Value: String); virtual;

This item is declared in ancestor TCastleComponent.

This item has no description.

Source: base/castleclassutils.pas (line 576).

Protected procedure SetName(const Value: TComponentName); override;

This item is declared in ancestor TCastleComponent.

This item has no description.

Source: base/castleclassutils.pas (line 577).

Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); virtual;

This item is declared in ancestor TCastleComponent.

Enumerate all properties that are possible to translate in this component. E.g. in TCastleLabel it will return TCastleLabel.Caption, in TCastleEdit it will return TCastleEdit.Text and TCastleEdit.Placeholder.

Returns only non-empty properties, thus assuming that if current (by convention, English) text is empty, then there is no point in translating it. Moreover descendants may define boolean properties to exclude particular text from translating, e.g. TCastleLabel.CaptionTranslate, TCastleEdit.TextTranslate, TCastleEdit.PlaceholderTranslate.

It is not recursive (it doesn't enumerate children properties). Use global TranslateProperties procedure to call this on a hierarchy of TComponent.

You usually don't want to call this method (it is called by other engine routines). But you may find it useful to override this, if you define new component.

Source: base/castleclassutils.pas (line 598).

Public procedure SetTransient;

This item is declared in ancestor TCastleComponent.

Ignore this component when serializing parent's TCastleUserInterface.Controls list or TCastleTransform.List, and do not show this component in CGE editor. This simply sets csTransient flag in ComponentStyle.

This is useful for children that are automatically managed by the parent, and should not be modified by user code. For example, TCastleCheckbox is internally composed from TCastleImageControl and TCastleLabel children, but we don't want to serialize or even show these children to user.

Note that if you want to prevent this component from serializing as part of TCastleUserInterface.Controls list or TCastleTransform.List, but you still want it to be visible in CGE editor, then make it a "subcomponent" instead, by SetSubComponent(true).

Note that both csSubComponent and csTransient only disable the component serialization as part of parent's lists enumerated by CustomSerialization (see internal TCastleUserInterface.SerializeChildrenEnumerate , TCastleTransform.SerializeChildrenEnumerate, TCastleTransform.SerializeBehaviorsEnumerate).

If you will make the component published in its own property (which is normal for "subcomponents") then it will be serialized anyway, just as part of it's own property (like TCastleScrollView.ScrollArea). So to really avoid serializing a children component make it csSubComponent and/or csTransient, and do not publish it.

Source: base/castleclassutils.pas (line 663).

Public procedure AddNonVisualComponent(const NonVisualComponent: TComponent);

This item is declared in ancestor TCastleComponent.

Add non-visual component to this component. This is used to organize non-visual components in a tree hierarchy, in CGE designs and editor.

See also
NonVisualComponentsCount
Count of components added by AddNonVisualComponent.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 672).

Public procedure InsertNonVisualComponent(const Index: Integer; const NonVisualComponent: TComponent);

This item is declared in ancestor TCastleComponent.

Insert non-visual component to this component. This is used to organize non-visual components in a tree hierarchy, in CGE designs and editor.

See also
NonVisualComponentsCount
Count of components added by AddNonVisualComponent.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 681).

Public procedure RemoveNonVisualComponent(const NonVisualComponent: TComponent);

This item is declared in ancestor TCastleComponent.

Removes the component previously added by AddNonVisualComponent.

Source: base/castleclassutils.pas (line 684).

Public function NonVisualComponentsIndexOf(const NonVisualComponent: TComponent): Integer;

This item is declared in ancestor TCastleComponent.

Index of the previously added non-visual component. Returns -1 if the component was not found.

Source: base/castleclassutils.pas (line 688).

Public function NonVisualComponentsCount: Integer;

This item is declared in ancestor TCastleComponent.

Count of components added by AddNonVisualComponent.

See also
AddNonVisualComponent
Add non-visual component to this component.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 695).

Public function NonVisualComponentsEnumerate: TNonVisualComponentsEnumerator;

This item is declared in ancestor TCastleComponent.

You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do .... Do not call this method in other contexts, it is only useful for "for..in" construction.

See also
AddNonVisualComponent
Add non-visual component to this component.

Source: base/castleclassutils.pas (line 705).

Public function ValueIsStreamed: Boolean; virtual;

This item is declared in ancestor TCastleComponent.

Whether the current value of this object should be written to the stream. This should be True if anything inside this object should be serialized (which means it has non-default value or "stored" specifier indicates that it should be serialized).

This is used by CastleComponentSerialize, which is used in Castle Game Engine for all serialization.

In simple cases, this just says whether the current value of this object equals to some default value.

The default implementation of this class returns True (so always write).

Descendants that override this to sometimes return False (so no need to write) must be very careful: any addition of a new field requires extending this method, otherwise new field may not be saved sometimes (when all other fields are default). Descentants of such classes must also be aware of it. This check must include everything that is inside this object in JSON, including subcomponents and children objects (as done e.g. by TSerializationProcess.ReadWriteList). In practice, overriding this method is only reasonable for simple classes that will not change much in the future, like TCastleVector3Persistent.

The name of this method is consistent with TPropertyEditor.ValueIsStreamed in LCL.

Source: base/castleclassutils.pas (line 739).

Public procedure DesignerInfo(const SList: TStrings); virtual;

This item is declared in ancestor TCastleComponent.

Override to add information that should be visible at design-time. Call SList.Add for each new line of information.

Source: base/castleclassutils.pas (line 743).

Protected function GetRenderList(const Params: TRenderParams): TCastleTransformList; virtual;

This item is declared in ancestor TCastleTransform.

Returns list of TCastleTransform to render. By default, it just returns List.

Source: transform/castletransform_transform.inc (line 329).

Protected procedure RegisterGLContextClose;

This item is declared in ancestor TCastleTransform.

Call this when doing anything that allocates GL resources. This will make sure GLContextClose will get called.

Source: transform/castletransform_transform.inc (line 333).

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

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 349).

Protected function HeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean;

This item is declared in ancestor TCastleTransform.

Height of a point above the 3D model. This checks ray collision, from APosition along the negated GravityUp vector. Measures distance to the nearest scene item (called "ground" here).

Parameters
AboveHeight
Height above the ground. One height unit equals one GravityUp vector. Always use normalized GravityUp vector if you expect to receive here a normal distance.

AboveHeight is always set to MaxSingle when returned result is False (this guarantee simplifies some code).

AboveGround
Pointer to PTriangle representing the ground. Must be Nil if returned result is False. May be Nil even if we returned True (not all 3D objects may be able to generate PTriangle information about collision).

This may be useful for example to make a footsteps sound dependent on texture of the ground. Or to decrease player life points for walking on hot lava. See "The Castle" game for examples.

Returns

If the 3D scene is hit. False means that APosition floats above an empty space. That is, if you turn gravity on, it will fall down forever, as far as this 3D scene is concerned.

Source: transform/castletransform_transform.inc (line 378).

Protected function MoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; overload;

This item is declared in ancestor TCastleTransform.

Can other 3D object (maybe a player) move without colliding with this object.

If IsRadius, then you should prefer to perform exact collision with sphere of given radius (must be > 0). At the very least, this checks that the line segment between OldPos and NewPos doesn't collide, and that sphere with given Radius centered around NewPos doesn't collide.

If not IsRadius, or if checking for collisions with sphere is not possible for some reasons, then you can check for collisions with boxes. OldBox should usually be ignored (it can be useful when collision-checking has to be approximate in some corner cases, see TCreature.MoveCollision). NewBox plays the same role as "sphere centered around NewPos" in paragraph above.

Overloaded version with separate ProposedNewPos and NewPos parameters allows you to accept the move, but for NewPos (that should be some slightly modified version of ProposedNewPos). This allows to implement wall-sliding: when camera tries to walk into the wall, we will change movement to move alongside the wall (instead of just completely blocking the move). When this version returns False, it's undefined what is the NewPos.

Source: transform/castletransform_transform.inc (line 406).

Protected function MoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; overload;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 411).

Protected function SegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean;

This item is declared in ancestor TCastleTransform.

Check collision with a line segment, that is: a line between 2 points in 3D.

Source: transform/castletransform_transform.inc (line 419).

Protected function SphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;

This item is declared in ancestor TCastleTransform.

Check collision with a 3D sphere.

This works precisely when transformation hierarchy has uniform scaling, i.e. scale is the same in all X, Y, Z axes. In case of non-uniform scaling, this is an approximation.

Source: transform/castletransform_transform.inc (line 428).

Protected function SphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails = nil): boolean;

This item is declared in ancestor TCastleTransform.

Check collision with a sphere in 2D (a circle, extruded to infinity along the Z axis).

Note that PointCollision2D and SphereCollision2D do not work reliably on objects that have 3D rotations. See PointCollision2D for details.

This works precisely when transformation hierarchy has uniform scaling, i.e. scale is the same in all X, Y, Z axes. In case of non-uniform scaling, this is an approximation.

Parameters
Details
If non-nil, these are automatically filled with the details about the collision. If the result is False, the Details contents are untouched. If the result is True, the Details contents are set to describe the 3D objects hierarchy that caused this collision.

Source: transform/castletransform_transform.inc (line 446).

Protected function PointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;

This item is declared in ancestor TCastleTransform.

Check collision with a point in 2D (which is an infinite line along the Z axis in 3D).

Note that PointCollision2D and SphereCollision2D do not work reliably on objects that have 3D rotations, that is: rotations that change the direction of Z axis! This applies to all ways of rotating – using the TCastleTransform or using the X3D node TTransformNode (within a TCastleSce).

  1. The reason: we transform the point (or sphere center) to the local coordinates, and we should also transform the Z axis to the local coordinates, to be always correct. Right now, we don't do the latter.

  2. And we don't want to do it (at least not in all cases)! The simple 2D point collision check would then actually perform a 3D line collision check, thus PointCollision2D would lose all the speed benefits over LineCollision. PointCollision2D would become a simple shortcut to perform LineCollision with a line parallel to Z axis.

    And in case of 2D games, or mostly 2D games, this speed loss would not be justified. Often you know that your objects have no 3D rotations, for example if your animations are done in Spine.

  3. In the future, we may overcome this limitation. To do this, we will detect whether the transformation is "only 2D" (actually this part is easy, you can detect it by looking at the matrix even, so check whether appropriate numbers are zero). And then PointCollision2D will change to LineCollision, and SphereCollision2D will change to something like ExtrudedCircleCollision, only when necessary.

Source: transform/castletransform_transform.inc (line 485).

Protected function BoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean;

This item is declared in ancestor TCastleTransform.

Check collision with axis-aligned box in 3D.

Source: transform/castletransform_transform.inc (line 489).

Protected function RayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision;

This item is declared in ancestor TCastleTransform.

First object hit by the ray, as a TRayCollision. Returns a collision as TRayCollision instance, or Nil if no collision. Caller is responsible for freeing the returned TRayCollision instance.

Contrary to other collision routines, this should ignore the Collides property. The Collides property specifies whether item collides with camera. And this method is used for picking (pointing) 3D stuff — everything visible can be picked, collidable or not. Instead, this looks at Pickable and Exists properties.

This always returns the first collision with the world, that is the one with smallest TRayCollision.Distance. For example, when implemented in TCastleTransform, this checks collisions for all list items, and chooses the closest one.

Source: transform/castletransform_transform.inc (line 506).

Protected function Translation2D: TVector2; deprecated 'use TranslationXY';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use TranslationXY

Get translation in 2D (uses Translation, ignores Z coord).

Source: transform/castletransform_transform.inc (line 594).

Protected procedure TransformMatricesMult(var M, MInverse: TMatrix4); deprecated 'do not use this directly, instead use Transform and InverseTransform methods';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: do not use this directly, instead use Transform and InverseTransform methods

Transformation matrices, like Transform and InverseTransform.

Source: transform/castletransform_transform.inc (line 597).

Protected procedure TransformMatrices(out M, MInverse: TMatrix4); deprecated 'do not use this directly, instead use Transform and InverseTransform methods';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: do not use this directly, instead use Transform and InverseTransform methods

This item has no description.

Source: transform/castletransform_transform.inc (line 598).

Protected function AverageScale: Single;

This item is declared in ancestor TCastleTransform.

Average value of 3D scale in Scale. It is not calculated as a simple average, it's a little smarter to prevent from weird results sometimes, see Approximate3DScale.

Source: transform/castletransform_transform.inc (line 603).

Protected function AverageScale2D: Single;

This item is declared in ancestor TCastleTransform.

Average value of 2D scale, from XY components of Scale. It is not calculated as a simple average, it's a little smarter to prevent from weird results sometimes, see Approximate2DScale.

Source: transform/castletransform_transform.inc (line 608).

Protected procedure Fall(const FallHeight: Single); virtual;

This item is declared in ancestor TCastleTransform.

Called when fall ended. You can use FallHeight to decrease creature life or such.

Source: transform/castletransform_transform.inc (line 612).

Protected procedure ExistsInRootChanged; virtual;

This item is declared in ancestor TCastleTransform.

Override to be notified after ExistsInRoot value changed.

Source: transform/castletransform_transform.inc (line 619).

Public procedure DesignerWarnings(const SList: TStrings); override;

This item is declared in ancestor TCastleTransform.

This item has no description. Showing description inherited from TCastleComponent.DesignerWarnings.

Override to add warnings that should be visible at design-time. Call SList.Add for each new warning.

Source: transform/castletransform_transform.inc (line 713).

Public function GetEnumerator: TEnumerator;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 714).

Public function CheckCollides: Boolean;

This item is declared in ancestor TCastleTransform.

Does the item really collide. Trivial shortcut for checking Collides and Exists.

Source: transform/castletransform_transform.inc (line 730).

Public function GetCollides: boolean; virtual; deprecated 'use CheckCollides';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use CheckCollides

This item has no description.

Source: transform/castletransform_transform.inc (line 731).

Public function CheckPickable: boolean;

This item is declared in ancestor TCastleTransform.

Is the item really pickable. Trivial shortcut for checking Pickable and Exists.

Source: transform/castletransform_transform.inc (line 734).

Public function GetPickable: boolean; virtual; deprecated 'use CheckPickable';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use CheckPickable

This item has no description.

Source: transform/castletransform_transform.inc (line 735).

Public function CheckVisible: boolean;

This item is declared in ancestor TCastleTransform.

Is the item really visible. Trivial shortcut for checking Visible and Exists.

Source: transform/castletransform_transform.inc (line 738).

Public function GetVisible: boolean; virtual; deprecated 'use CheckVisible';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use CheckVisible

This item has no description.

Source: transform/castletransform_transform.inc (line 739).

Public procedure Add(const Item: TCastleTransform);

This item is declared in ancestor TCastleTransform.

Add a child.

Note that adding the same child multiple times is allowed, in general you can use the same TCastleTransform instance multiple times in one hierarchy of TCastleRootTransform.

Source: transform/castletransform_transform.inc (line 746).

Public procedure Insert(const Index: Integer; const Item: TCastleTransform);

This item is declared in ancestor TCastleTransform.

Insert a child at a specific position on the children list.

Note: Usually the order of children doesn't matter, so you can as well add children at the end, using Add.

In particular, when rendering opaque (3D or 2D) objects, the front/back is decided by the actual translation of the object, i.e. what is closer to the camera. (In a typical 2D setup, larger Z values mean "closer to the camera".) The position on the children list doesn't matter in this case.

When rendering with blending, we recommend to use TCastleViewport.BlendingSort to automatically use proper order when rendering partially-transparent objects. This will mean that the order of children really doesn't matter.

However, the position matters in case of blending, if you set TCastleViewport.BlendingSort to sortNone. See https://castle-engine.io/blending . For correct blending, when you have multiple partially-transparent scenes, the partially-transparent objects must be sorted from back to front on the list. So you should add them in the proper order, or insert on proper positions.

Source: transform/castletransform_transform.inc (line 770).

Public procedure Remove(const Item: TCastleTransform);

This item is declared in ancestor TCastleTransform.

Remove a child.

Adding and removing from the TCastleTransform hierarchy is guaranteed to be fast, so you can do it even in the middle of the game. In particular calling Remove doesn't free rendering reasources of the removed scene, So e.g. removing scene only to add it later to another TCastleViewport.Items is fast.

Note that removing the child Item does not free the Item. It merely makes the Item no longer be a child of this TCastleTransform, so it will no longer be shown in the viewport. If you want to free the item instance, you have to do it explicitly, by Item.Free or FreeAndNil(Item). Freed items are automatically removed from parent. See also What is the difference between Owner and Parent in CGE?.

Source: transform/castletransform_transform.inc (line 789).

Public procedure RemoveDelayed(const Item: TCastleTransform; const FreeItem: Boolean = false);

This item is declared in ancestor TCastleTransform.

Use this to remove (and possibly free) the child, but not immediately.

The actual removal (and freeing, if FreeItem) will be done at some crucial points:

  • Right before we render children.

  • Right before we loop over children in the Update method.

  • Right after we loop over children in the Update method.

  • From our destructor.

This allows to use this method safely even in the middle of iteration over TCastleTransform children. For example you can use it from Update method, from any TCastleTransform.Update or TCastleUserInterface.Update (including TCastleView.Update).

Note: It is not a problem if the child scheduled to be removed will also be removed (or even freed) directly e.g. by just calling Free on it. We ignore removal of items that are no longer our children, and we automatically remove the child from "pending to remove" list if it is freed. You only need to be careful in case you add the same TCastleTransform instance multiple times to the same parent (see https://castle-engine.io/viewport_and_scenes_from_code#_multiple_instances_of_the_same_scene ) as then each removal removes one instance (not all) of the child from parent.

Note: When you want to free the Item (that is, FreeItem parameter is True) then it actually doesn't matter on what parent will you call this. Freeing the Item will always remove it from all parents.

Source: transform/castletransform_transform.inc (line 819).

Public procedure Delete(const Index: Integer);

This item is declared in ancestor TCastleTransform.

Remove a child, by index on the Items list.

Source: transform/castletransform_transform.inc (line 822).

Public function Count: Integer;

This item is declared in ancestor TCastleTransform.

Count of current children, to iterate over Items from 0 to Count-1.

Source: transform/castletransform_transform.inc (line 828).

Public procedure Clear;

This item is declared in ancestor TCastleTransform.

Remove all children TCastleTransform instances.

Note that removing the children using this method, just like using Remove, does not free the children. It merely makes the children no longer be inside this TCastleTransform, so they will no longer be shown in the viewport. If you want to free the children, you have to do it explicitly, calling Item.Free or FreeAndNil(Item) for each child. Freed items are automatically removed from parent. See also What is the difference between Owner and Parent in CGE?.

Source: transform/castletransform_transform.inc (line 842).

Public procedure Exchange(const Index1, Index2: Integer);

This item is declared in ancestor TCastleTransform.

Exchange position of 2 children TCastleTransform instances.

Source: transform/castletransform_transform.inc (line 845).

Public function BoundingBox: TBox3D;

This item is declared in ancestor TCastleTransform.

Bounding box of this object, in the coordinate system of the parent transformation. This method takes into account current transformation (like Translation, Rotation) but not parent TCastleTransform transformations. Use WorldBoundingBox instead to know bounding box that accounts for all TCastleTransform transformations. Use LocalBoundingBox instead to know bounding box that does not account for any parent or this TCastleTransform transformations.

Takes into account both collidable and visible objects. For example, invisible walls (not visible) and fake walls (not collidable) should all be accounted here.

It's a bounding volume, it should be as large as necessary to include the object inside. At the same time, it should be as "tight" as it can, to make various optimizations work best.

See also
WorldBoundingBox
Bounding box of this object, taking into account all transformations of this and parents.
LocalBoundingBox
Bounding box of this object, ignoring the transformations of this scene and parents.

Source: transform/castletransform_transform.inc (line 914).

Public function WorldBoundingBox: TBox3D;

This item is declared in ancestor TCastleTransform.

Bounding box of this object, taking into account all transformations of this and parents.

See also
BoundingBox
Bounding box of this object, in the coordinate system of the parent transformation.
LocalBoundingBox
Bounding box of this object, ignoring the transformations of this scene and parents.

Source: transform/castletransform_transform.inc (line 927).

Public procedure Render(const Params: TRenderParams); overload; virtual;

This item is declared in ancestor TCastleTransform.

Render given object. Should check and immediately exit when CheckVisible is False.

The rendering transformation, frustum, and filtering is specified inside TRenderParams class. This method should only update TRenderParams.Statistics.

Source: transform/castletransform_transform.inc (line 935).

Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); overload; deprecated 'use Render method without an explicit Frustum parameter, it is in Params.Frustum now';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use Render method without an explicit Frustum parameter, it is in Params.Frustum now

This item has no description.

Source: transform/castletransform_transform.inc (line 937).

Public procedure RenderShadowVolume(const Params: TRenderParams; const ShadowVolumeRenderer: TBaseShadowVolumeRenderer);

This item is declared in ancestor TCastleTransform.

Render shadow quads for all the things rendered by Render. This is done only if Exists and CastShadows.

It does shadow volumes culling inside (so ShadowVolumeRenderer should have FrustumCullingInit already initialized).

Params.Transformation describe the transformation, just like for Render.

Source: transform/castletransform_transform.inc (line 954).

Public procedure AddAfterUpdateListener(const UpdateListener: TNotifyEvent);

This item is declared in ancestor TCastleTransform.

Called on update. Update listeners fire after all behaviors have been processed.

Source: transform/castletransform_transform.inc (line 1100).

Public procedure RemoveAfterUpdateListener(const UpdateListener: TNotifyEvent);

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1101).

Public procedure VisibleChangeHere(const Changes: TVisibleChanges); virtual;

This item is declared in ancestor TCastleTransform.

Something visible changed inside this object. This is usually called by implementation of this object, to notify others that it changed.

Changes is a set describing what changes occurred. See TVisibleChange docs for more information. It must specify all things that possibly changed.

Changes can be [], meaning "something tells us to redraw, but no visible change happened yet, maybe something will happen during a redraw" (this is used when e.g. possibly LOD level changed). We still increase TCastleAbstractRootTransform.InternalVisibleStateId even when Changes=[].

The information about visibility changed is passed to TCastleAbstractRootTransform in World. It increases TCastleAbstractRootTransform.InternalVisibleStateId, TCastleAbstractRootTransform.InternalVisibleGeometryStateId, TCastleAbstractRootTransform.InternalVisibleNonGeometryStateId. If you want to react to visibility changes, you should not override this method, instead watch above "state id" variables and react when they change.

Source: transform/castletransform_transform.inc (line 1125).

Public function Middle: TVector3; virtual;

This item is declared in ancestor TCastleTransform.

Middle point, usually "eye point", of the 3D model. This is used for sphere center (if CollisionSphereRadius is non-zero or Sphere returns True) and is the central point from which collisions of this object are checked (Move, MoveAllowed, Height, LineOfSight). It's useful for dynamic objects like player and moving creatures, which rely on MoveAllowed and gravity.

In short, it's usually most comfortable to think about this as a position of the eye, or the middle of the creature's head.

In an ideal situation, it should not be based on anything dynamic. For example, when this is based on the current bounding box of the animation, there is a risk that a large and sudden change in animation box could make the Middle point to jump to the other side of the wall (breaking collisions, as it changes Middle without a chance to check for collisions by MoveAllowed). Ideally, it should remain constant even when the shape of the object changes, and be possible to change only when MoveAllowed is checked (so only when TCastleTransform.Translation can change).

In this class this returns something sensible above the bottom of the box. See TCastleTransform.MiddleHeight.

This is expressed in the parent coordinate system (so it is close to the Translation value, but moved up, following GravityUp). So use Transform.Parent.LocalToWorld(Transform.Middle) to convert this to world coordinates.

Source: transform/castletransform_transform.inc (line 1168).

Public function WorldMiddle: TVector3;

This item is declared in ancestor TCastleTransform.

Our Middle, in world coordinates.

Source: transform/castletransform_transform.inc (line 1174).

Public function Sphere(out Radius: Single): boolean; virtual;

This item is declared in ancestor TCastleTransform.

Can the approximate sphere (around Middle point) be used for some collision-detection tasks. If True then Radius (and Middle point) determine the approximate sphere surrounding the 3D object (it does not have to be a perfect bounding sphere around the object), and it may be used for some collisions instead of BoundingBox. See CollidesWithMoving and MoveAllowed for when it may happen.

Just like Middle and CollisionSphereRadius, this is expressed in the parent coordinate system.

Must return False when not Exists (because we can't express "empty sphere" by Sphere method for now, but BoundingBox can express TBox3D.Empty).

By default, in TCastleTransform class, this returns True if CollisionSphereRadius is non-zero.

The advantages of using a sphere, that does not have to be a perfect bounding sphere (it may be smaller than necessary, and only account e.g. for upper body part of the creature), are:

  • It can have constant radius, even though the actual creature animates. This allows us to perfectly, reliably guarantee that sphere absolutely never collides with level and such.

    In case of a tight bounding volume (box or sphere) that animates, this guarantee is not really possible. Simply increasing time changes the animation to the next frame, which may be slightly larger in one dimension because e.g. creature moves a hand in this direction. This means that simply increasing time may change the non-collidable creature into a collidable one, if creature stands close to a wall/other creature and such. And we cannot simply stop/reverse an arbitrary animation at an arbitrary time (to avoid collision), this would look weird for some animations and would require some additional work at preparing animations and designing AI (as then "every action can be interrupted").

    Also using a bounding volume large enough to account for all possible positions is not doable, as it would be too large. Consider that for humanoid creatures, walking animation usually has tall and thin bounding box (creature stands) but dead/lying animation usually has flat and wide bounding box.

    So, only a bounding volume (like a sphere) that may be smaller than bounding volume can remain constant and easily guarantee the assertion "it never collides".

    This means that using such sphere results in simpler collision detection routines, as they may assume that collision doesn't occur. In contrast, detection routines looking at our (possibly animated) BoundingBox must take into account that collision may already be happening, and they must incorporate code to allow creatures/players to "get unstruck".

  • Using smaller sphere also allows to naturally ascend the stairs and upward slopes. Sphere can move forward slightly, and then creature may raise up, to reach it's preferred height. Then sphere can move further forward, and so on. This alllows to allow stair climbing for creatures without any extra effort in the code.

    The downside is that creature legs will temporarily "sink into the floor" when climbing up the stairs. But it's not noticeable if "growing up" mechanism works fast enough.

Sphere disadvantage:

  • Sphere is far from perfect as a bounding volume — it's too small, sometimes also too large, sometimes both at the same time...

    Since the Sphere radius remains always the same, it must be good for many creature animation frames. In cases where the sphere isn't suitable, and you don't need advantages above — you can make Sphere return False. E.g. a dead creature may be stuck in a wall, and it doesn't have to climb stairs. So you don't really need sphere advantages listed above, and Sphere may return False when creature is in dying state.

    But still it may be a problem sometimes, if some creature states have entirely different animations and bounding boxes. Then you will be forced to choose one universal Radius for all creature states. And you need constant radius to keep the advantage above of "guarantee".

    1. Obviously you can't set radius too small, because if it's much smaller than actual creature's geometry then the creature will noticeably collide with level geometry and other creatures.

    2. On the other hand, you can't set radius too large (or move sphere center, Middle, much lower). This would block stair climbing.

Source: transform/castletransform_transform.inc (line 1271).

Public function Height(const MyPosition: TVector3; out AboveHeight: Single): boolean; overload;

This item is declared in ancestor TCastleTransform.

Get height of my point above the rest of the world.

The given MyPosition, and returned AboveHeight, are in the parent coordinate system of this TCastleTransform. So for example query like this works naturally: MyTransform.Height(MyTransform.Translation, ...).

This ignores the geometry of this 3D object (to not accidentally collide with your own geometry), and checks collisions with the rest of the world.

Source: transform/castletransform_transform.inc (line 1296).

Public function Height(const MyPosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; overload;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1298).

Public function LineOfSight(const Pos1, Pos2: TVector3): boolean;

This item is declared in ancestor TCastleTransform.

Whether there is line of sight (the line segment does not collide with anything opaque) between these 2 points.

The given Pos1, Pos2 are in the parent coordinate system of this TCastleTransform. So for example query like this works naturally: MyTransform.LineOfSight(MyTransform.Translation, MyTransform.Translation + MyTransform.Direction * 10).

This ignores the geometry of this 3D object (to not accidentally collide with your own geometry), and checks collisions with the rest of the world.

Source: transform/castletransform_transform.inc (line 1312).

Public function MoveAllowed(const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const BecauseOfGravity: boolean): boolean; overload;

This item is declared in ancestor TCastleTransform.

Is the move from OldPos to ProposedNewPos possible for this object. Returns true and sets NewPos if some move is allowed.

The NewPos may be different than ProposedNewPos, which allows to perform wall-sliding. Wall sliding will only work if collision sphere is defined, which should be configured by setting CollisionSphereRadius to something non-zero. Otherwise, the move uses only box collisions, and wall sliding doesn't happen.

When checking collisions, it avoids colliding with itself, so it only checks collisions with the rest of the world (things outside of this TCastleTransform).

The given OldPos, ProposedNewPos, NewPos are in the parent coordinate system of this TCastleTransform. Intuitively, you are asking "Can I change Translation from OldPos to NewPos". So this method is consistent with Move, Translate.

Source: transform/castletransform_transform.inc (line 1331).

Public function MoveAllowed(const OldPos, NewPos: TVector3; const BecauseOfGravity: boolean): boolean; overload;

This item is declared in ancestor TCastleTransform.

Is the move from OldPos to NewPos possible for this object.

This overloaded version of MoveAllowed doesn't do wall-sliding (use the version with ProposedNewPos for wall-sliding).

If this object allows to use sphere for collisions (see CollisionSphereRadius and Sphere) then sphere will be used. Otherwise, it will collide as a bounding box.

When checking collisions, it avoids colliding with itself, so it only checks collisions with the rest of the world (things outside of this TCastleTransform).

The given OldPos, NewPos are in the parent coordinate system of this TCastleTransform. Intuitively, you are asking "Can I change Translation from OldPos to NewPos". So this method is consistent with Move, Translate.

Source: transform/castletransform_transform.inc (line 1352).

Public function Ray(const RayOrigin, RayDirection: TVector3): TRayCollision;

This item is declared in ancestor TCastleTransform.

Cast a ray, see what is hit (checks the whole world, not just this TCastleTransform hierarchy).

The given RayOrigin, RayDirection are in the parent coordinate system of this TCastleTransform. So for example query like this works naturally: MyTransform.Ray(MyTransform.Translation, MyTransform.Direction).

This ignores the geometry of this object (to not accidentally collide with your own geometry), and checks collisions with the rest of the world.

Source: transform/castletransform_transform.inc (line 1368).

Public function RayCast(const RayOrigin, RayDirection: TVector3): TCastleTransform; overload;

This item is declared in ancestor TCastleTransform.

Cast a ray, see what is hit (checks the whole world, not just this TCastleTransform hierarchy).

The given RayOrigin, RayDirection are in the parent coordinate system of this TCastleTransform. So for example query like this works naturally: MyTransform.RayCast(MyTransform.Translation, MyTransform.Direction). In case of the overloaded version with Distance parameter, the Distance is consistently in the same, parent coordinate system.

This ignores the geometry of this object (to not accidentally collide with your own geometry), and checks collisions with the rest of the world.

This returns the TCastleTransform that is hit (this is the "leaf" TCastleTransform in the TCastleTransform tree that is hit) and a distance from RayOrigin to the hit point. Returns Nil (Distance is undefined in this case) if nothing was hit. Use Ray for a more advanced version of this, with more complicated result.

Source: transform/castletransform_transform.inc (line 1388).

Public function RayCast(const RayOrigin, RayDirection: TVector3; out Distance: Single): TCastleTransform; overload;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1390).

Public function OutsideToLocal(const Pos: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

Convert position between local and outside coordinate system. This is called OutsideToLocal, not WorldToLocal, because it only handles transformation defined in this item — it does not recursively apply all transform on the way to root.

Source: transform/castletransform_transform.inc (line 1398).

Public function LocalToOutside(const Pos: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1399).

Public function WorldToLocal(const Pos: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

Convert position between local and world coordinate system. This applies all the transformations on the way to root, so it looks at this object as well as all parents' transformations.

Source: transform/castletransform_transform.inc (line 1406).

Public function LocalToWorld(const Pos: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1407).

Public function WorldToLocalDirection(const Dir: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

Convert direction between local and world coordinate system. This applies all the transformations on the way to root, so it looks at this object as well as all parents' transformations.

Source: transform/castletransform_transform.inc (line 1414).

Public function LocalToWorldDirection(const Dir: TVector3): TVector3;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1415).

Public function LocalToWorldDistance(const Distance: Single): Single;

This item is declared in ancestor TCastleTransform.

Convert distance, like sphere radius, between local and world coordinate system. This applies all the scaling on the way to root, so it looks at this object as well as all parents' transformations.

Source: transform/castletransform_transform.inc (line 1422).

Public function WorldToLocalDistance(const Distance: Single): Single;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1423).

Public function PreferredHeight: Single; virtual; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity

The preferred height of the object Middle above the ground, when the object is standing on the ground firmly. This is used by objects affected by gravity (like non-flying creatures and items) to know how far they should fall down or grow up.

The default implementation in this class looks at MiddleHeight property, see the algorithm described there. This may be dynamic (may change during creature lifetime, so you can make the creature duck or grow if you want).

Source: transform/castletransform_transform.inc (line 1467).

Public function Transform: TMatrix4;

This item is declared in ancestor TCastleTransform.

Transformation (from local to outside) as a matrix. This matrix represents a concise version of properties like Translation, Rotation, Scale. It does not take into account the transformation of parent TCastleTransform (for this, use WorldTransform).

Source: transform/castletransform_transform.inc (line 1523).

Public function InverseTransform: TMatrix4;

This item is declared in ancestor TCastleTransform.

Inverse transformation as a matrix, thus transforming from outside to local coordinate system. This is an inverse of Transform.

Source: transform/castletransform_transform.inc (line 1527).

Public function HasWorldTransform: boolean;

This item is declared in ancestor TCastleTransform.

All conditions are satisfied to have WorldTransform. When this returns True, you know that WorldTransform and WorldInverseTransform will not raise ETransformParentUndefined.

Source: transform/castletransform_transform.inc (line 1532).

Public function WorldTransform: TMatrix4;

This item is declared in ancestor TCastleTransform.

Transformation (from local to world) as a matrix. This accumulates the transformation of this instance (derived from properties like Translation, Rotation, Scale) with the transformation of parent TCastleTransform instances, all the way up to and including the root transformation (TCastleAbstractRootTransform). Thus, this is a transformation to the world known to the TCastleViewport instance.

Two conditions are necessary to make this available:

You can check HasWorldTransform before calling this method, to avoid catching an exception.

Note that the WorldTransform is not updated in Update, it is smartly updated on-demand. So you do not have to wait for Update or other method to be called before accessing the WorldTransform.

Exceptions raised
ENotAddedToWorld
When this instance is not yet part of World.
EMultipleReferencesInWorld
When this instance is added multiple times to World.
ETransformParentUndefined
When this instance was once added multiple times to World, or for some other reason cannot be calculated. This is an ancestor of ENotAddedToWorld and EMultipleReferencesInWorld too.

Source: transform/castletransform_transform.inc (line 1588).

Public function WorldInverseTransform: TMatrix4;

This item is declared in ancestor TCastleTransform.

Inverse transformation of WorldTransform, thus transforming from world to local coordinate system.

See WorldTransform for more details how this works.

Exceptions raised
ENotAddedToWorld
When this instance is not yet part of World.
EMultipleReferencesInWorld
When this instance is added multiple times to World.
EMultipleReferencesInWorld
When this instance was once added multiple times to World, or for some other reason cannot be calculated. This is an ancestor of ENotAddedToWorld and EMultipleReferencesInWorld too.

Source: transform/castletransform_transform.inc (line 1605).

Public procedure Translate(const TranslationChange: TVector3);

This item is declared in ancestor TCastleTransform.

Unconditionally move this object by a given vector.

To move and check collisions, use Move instead of this method.

The provided TranslationChange should be a direction in the parent coordinate system of this TCastleTransform. Using this routine is exactly equivalent to Translation := Translation + TranslationChange.

Source: transform/castletransform_transform.inc (line 1615).

Public function Move(const TranslationChange: TVector3; const BecauseOfGravity: boolean; const EnableWallSliding: boolean = true): boolean;

This item is declared in ancestor TCastleTransform.

Move, if possible (checking collisions with other objects in world). This is the simplest way to move an object, and a basic building block for artificial intelligence of creatures.

Checks move possibility by MoveAllowed, using Middle point. Actual move is done using Translate.

Note that wall sliding will only work if collision sphere is defined, which should be configured by setting CollisionSphereRadius to something non-zero. Otherwise, the move uses only box collisions, and wall sliding doesn't happen.

The provided TranslationChange should be a direction in the parent coordinate system of this TCastleTransform, so using this routine is consistent with doing Translation := Translation + TranslationChange however this checks collisions.

Source: transform/castletransform_transform.inc (line 1633).

Public procedure Identity;

This item is declared in ancestor TCastleTransform.

Make the transform do nothing — zero Translation, zero Rotation, Scale to one. Also resets ScaleOrientation and Center.

Source: transform/castletransform_transform.inc (line 1759).

Public procedure GetView(out APos, ADir, AUp: TVector3);

This item is declared in ancestor TCastleTransform.

Get at once vectors: position, direction, up.

Just like Translation and Rotation, these vectors reflect the transformation defined locally in this TCastleTransform, disregarding the parent transformations. Use GetWorldView to account for parent transformations.

Source: transform/castletransform_transform.inc (line 1896).

Public procedure GetWorldView(out APos, ADir, AUp: TVector3);

This item is declared in ancestor TCastleTransform.

Get position, direction, up. Similar to GetView, but in world coordinates.

Returned ADir and AUp are always orthogonal. Returned ADir and AUp are always normalized.

Source: transform/castletransform_transform.inc (line 1902).

Public function WorldTranslation: TVector3;

This item is declared in ancestor TCastleTransform.

Get position in world coordinates.

The returned position is the same as by GetWorldView. This method just doesn't calculation anything else, thus it is faster than GetWorldView if you don't need direction/up.

Source: transform/castletransform_transform.inc (line 1923).

Public procedure SetView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true); overload;

This item is declared in ancestor TCastleTransform.

Set at once vectors: position, direction, up.

ADir and AUp given here do not have to be normalized (they will be normalized if needed). They will be automatically fixed to be orthogonal, if necessary: when AdjustUp = True (the default) we will adjust the up vector (preserving the given direction value), otherwise we will adjust the direction (preserving the given up value).

Just like Translation and Rotation, these vectors reflect the transformation defined locally in this TCastleTransform, disregarding the parent transformations. Use SetWorldView to account for parent transformations.

Source: transform/castletransform_transform.inc (line 1938).

Public procedure SetView(const ADir, AUp: TVector3; const AdjustUp: boolean = true); overload;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1940).

Public procedure SetWorldView(const APos, ADir, AUp: TVector3; const AdjustUp: boolean = true);

This item is declared in ancestor TCastleTransform.

Set position, direction, up. Similar to SetView, but in world coordinates.

Given ADir, AUp do not have to be normalized, we will normalize them internally if necessary. But make sure they are non-zero.

We will automatically fix ADir and AUp to be orthogonal, if necessary: when AdjustUp = True (the default) we will adjust the up vector (preserving the given direction value), otherwise we will adjust the direction (preserving the given up value).

Source: transform/castletransform_transform.inc (line 1953).

Public procedure UpPrefer(const AUp: TVector3);

This item is declared in ancestor TCastleTransform.

Change up vector, keeping the direction unchanged. If necessary, the up vector provided here will be fixed to be orthogonal to direction.

This is similar to assigning Up vector using it's property setter, but different behavior happens when we need to fix vectors to have direction orthogonal to up (which must be always true). In case of assigning Up by property setter, the Direction vector is changed (if necessary, to be orthogonal to up). In case of this method, the up vector is changed (if necessary, to be orthogonal to direction).

It's good to use this if you have a preferred up vector for creatures, but still preserving the direction vector has the highest priority.

Source: transform/castletransform_transform.inc (line 1970).

Public procedure AddBehavior(const Behavior: TCastleBehavior);

This item is declared in ancestor TCastleTransform.

Add a TCastleBehavior to this TCastleTransform. In effect, the virtual methods of TCastleBehavior, like TCastleBehavior.Update, will be automatically called. Also the TCastleBehavior.Parent gets assigned.

If the given Behavior was part of another TCastleTransform, it is removed from it. If the given Behavior was already part of this TCastleTransform, nothing happens (note: we do not move the behavior to the end of the list).

See also
FindBehavior
Find the first behavior of the given class, Nil if none.
BehaviorsEnumerate
You can enumerate current behaviors using loop like for B in MyTransform.BehaviorsEnumerate do ....

Source: transform/castletransform_transform.inc (line 2016).

Public procedure InsertBehavior(const Index: Integer; const Behavior: TCastleBehavior);

This item is declared in ancestor TCastleTransform.

Insert a TCastleBehavior to this TCastleTransform at a specified index. In effect, the virtual methods of TCastleBehavior, like TCastleBehavior.Update, will be automatically called. Also the TCastleBehavior.Parent gets assigned.

If the given Behavior was part of another TCastleTransform, it is removed from it. If the given Behavior was already part of this TCastleTransform, nothing happens (note: we do not move the behavior to the new index).

See also
FindBehavior
Find the first behavior of the given class, Nil if none.
BehaviorsEnumerate
You can enumerate current behaviors using loop like for B in MyTransform.BehaviorsEnumerate do ....

Source: transform/castletransform_transform.inc (line 2030).

Public function BehaviorIndex(const Behavior: TCastleBehavior): Integer;

This item is declared in ancestor TCastleTransform.

Returns the behavior index, -1 means not found.

Source: transform/castletransform_transform.inc (line 2033).

Public procedure RemoveBehavior(const Behavior: TCastleBehavior);

This item is declared in ancestor TCastleTransform.

Remove TCastleBehavior from this TCastleTransform. In effect, the virtual methods of TCastleBehavior, like TCastleBehavior.Update, will no longer be automatically called. The TCastleBehavior.Parent is set to Nil.

Source: transform/castletransform_transform.inc (line 2039).

Public function FindBehavior(const BehaviorClass: TCastleBehaviorClass): TCastleBehavior;

This item is declared in ancestor TCastleTransform.

Find the first behavior of the given class, Nil if none.

Source: transform/castletransform_transform.inc (line 2042).

Public function FindAllBehaviors(const BehaviorClass: TCastleBehaviorClass): TCastleBehaviorList;

This item is declared in ancestor TCastleTransform.

Find all behaviors of given class, in this transform and children (up to any depth). The behaviors are added to the list, disregaring the Exists or ExistsInRoot property of parents. Returned class does not own children. The caller is responsible for freeing the returned list.

Source: transform/castletransform_transform.inc (line 2048).

Public function FindRequiredBehavior(const BehaviorClass: TCastleBehaviorClass): TCastleBehavior;

This item is declared in ancestor TCastleTransform.

Find the first behavior of the given class, or create and add a new one if necessary. Never returns Nil.

Source: transform/castletransform_transform.inc (line 2052).

Public function BehaviorsCount: Integer;

This item is declared in ancestor TCastleTransform.

Count of behaviors.

See also
AddBehavior
Add a TCastleBehavior to this TCastleTransform.
RemoveBehavior
Remove TCastleBehavior from this TCastleTransform.

Source: transform/castletransform_transform.inc (line 2057).

Public function BehaviorsEnumerate: TCastleBehaviorEnumerator;

This item is declared in ancestor TCastleTransform.

You can enumerate current behaviors using loop like for B in MyTransform.BehaviorsEnumerate do .... Do not call this method in other contexts, it is only useful for "for..in" construction.

Source: transform/castletransform_transform.inc (line 2067).

Public procedure AddWorldChangeNotification(const Behavior: TCastleBehavior);

This item is declared in ancestor TCastleTransform.

Adds a behavior to the list that needs to be informed about the world change. Adding multiple times the same behavior is harmless and has no effect.

Source: transform/castletransform_transform.inc (line 2071).

Public procedure RemoveWorldChangeNotification(const Behavior: TCastleBehavior);

This item is declared in ancestor TCastleTransform.

Removes a behavior from the list that needs to be informed about the world change.

Source: transform/castletransform_transform.inc (line 2075).

Public function InternalBuildNode: TObject;

This item is declared in ancestor TCastleTransform.

Create X3D nodes graph representing this TCastleTransorm (and its children). This can be used to save to any format supported by the SaveNode, like X3D and STL. See this news post for a summary of available features.

This method is internal, because:

  • It is not the adviced way to save TCastleTransform to file. Rather, we advise to save hierarchy using the TransformSave to .castle-transform files. See also CastleComponentSerialize. You can then reuse designs using the TCastleTransformDesign component. This is the way to reliably save and restore 100% of published properties of TCastleTransform and its descendants.

  • The export is not complete, and it will never be. X3D and other formats cannot express everything that Castle Game Engine components can express.

  • While you can load the resulting X3D back inside the engine editor, this will be just a single component TCastleScene, not all the components you exported.

    (though it could be an option some day, see https://castle-engine.io/expose ).

    Solution: If you want to use CGE editor for authoring X3D or other model formats, just keep the original CGE editor files around, as the "source" version of your 3D / 2D world and export it to X3D as many times as you wish.

That said, this is useful, because:

  • It allows to open things designed in CGE in X3D browsers, like Castle Model Viewer, Castle Model Viewer Mobile, X3DOM (in WWW browser), X_ITE (in WWW browser), FreeWRL. See X3D Resources for even more useful tools.

  • It's useful for debugging purposes when developing CGE.

    Since some CGE components are realized under the hood using X3D as well, e.g. light components like TCastlePointLight are mostly just wrappers for X3D nodes like TPointLightNode – just with somewhat better defaults and sometimes better naming. Though it is not guaranteed to always be like it (our own components allow us to implement lights without X3D nodes under the hood as well), but when it is -> this method allows to "peek under the hood" at nodes really used to render.

Result must be TTransformNode but it cannot be declared as such.

It exports content for all nodes, even csTransient, and thus it is never Nil. Caller should avoid check for csTransient in Transform.ComponentState if you want to avoid this.

Source: transform/castletransform_transform.inc (line 2156).

Protected procedure ExecuteCompiledScript(const HandlerName: string; ReceivedValue: TX3DField); virtual; abstract;

This item is declared in ancestor TX3DEventsEngine.

This item has no description.

Source: scene/x3d/x3dnodes_eventsengine.inc (line 35).

Public procedure InternalChangedField(const Field: TX3DField; const Change: TX3DChange); overload; virtual; abstract;

This item is declared in ancestor TX3DEventsEngine.

This item has no description.

Source: scene/x3d/x3dnodes_eventsengine.inc (line 53).

Public procedure InternalChangedField(const Field: TX3DField); overload;

This item is declared in ancestor TX3DEventsEngine.

This item has no description.

Source: scene/x3d/x3dnodes_eventsengine.inc (line 54).

Public function InternalCastingShadowVolumesNow: Boolean; virtual; abstract;

This item is declared in ancestor TX3DEventsEngine.

This item has no description.

Source: scene/x3d/x3dnodes_eventsengine.inc (line 55).

Protected function InternalBuildNodeInside: TObject; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description. Showing description inherited from TCastleTransform.InternalBuildNodeInside.

Helper for InternalBuildNode. Result must be TAbstractChildNode or Nil.

Source: scene/castlescenecore.pas (line 851).

Protected procedure UpdateHeadlightOnFromNavigationInfo;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 867).

Protected procedure ChangedTransform; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description. Showing description inherited from TCastleTransform.ChangedTransform.

Override to be notified about every transformation change. By default, this calls VisibleChangeHere, which causes the window to redraw.

Source: scene/castlescenecore.pas (line 880).

Protected procedure DoPointingDeviceSensorsChange; virtual;

This item is declared in ancestor TCastleSceneCore.

Called after PointingDeviceSensors or PointingDeviceActiveSensors lists (possibly) changed.

In this class, DoPointingDeviceSensorsChange updates Cursor and calls OnPointingDeviceSensorsChange.

Source: scene/castlescenecore.pas (line 888).

Protected procedure ExecuteCompiledScript(const HandlerName: String; ReceivedValue: TX3DField); override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 890).

Protected function LocalHeightCollision(const APosition, GravityUp: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; out AboveHeight: Single; out AboveGround: PTriangle): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 892).

Protected function LocalMoveCollision( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 895).

Protected function LocalMoveCollision( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 900).

Protected function LocalSegmentCollision(const Pos1, Pos2: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const ALineOfSight: boolean): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 905).

Protected function LocalSphereCollision(const Pos: TVector3; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 908).

Protected function LocalSphereCollision2D(const Pos: TVector2; const Radius: Single; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc; const Details: TCollisionDetails): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 910).

Protected function LocalPointCollision2D(const Point: TVector2; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 913).

Protected function LocalBoxCollision(const Box: TBox3D; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 915).

Protected function LocalRayCollision(const RayOrigin, RayDirection: TVector3; const TrianglesToIgnoreFunc: TTriangleIgnoreFunc): TRayCollision; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 917).

Protected procedure Loaded; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 921).

Protected procedure InternalMoveShapeAssociations( const OldNode, NewNode: TX3DNode; const ContainingShapes: TObject); override;

This item is declared in ancestor TCastleSceneCore.

Called before changing one node into another, when old node may have beeen associated with a shape using TShapeTree.AssociateNode.

Both OldNode and NewNode may be Nil, this method can handle it.

It is allowed to call this even when OldNode = NewNode, which means that nothing really changes.

Source: scene/castlescenecore.pas (line 930).

Protected function LocalBoundingBoxNoChildren: TBox3D;

This item is declared in ancestor TCastleSceneCore.

Local (not affected by our Translation, Rotation, Scale) bounding box. Takes into account loaded scene (in Url) but not children TCastleTransform bounding volumes.

Source: scene/castlescenecore.pas (line 936).

Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override;

This item is declared in ancestor TCastleSceneCore.

This item has no description. Showing description inherited from TCastleComponent.CustomSerialization.

Override this method to call various methods of SerializationProcess, which in turn allows to serialize/deserialize things that are not published. This allows to serialize/deserialize with more freedom, e.g. to serialize/deserialize some private field.

Source: scene/castlescenecore.pas (line 967).

Public procedure Load(const ARootNode: TX3DRootNode; const AOwnsRootNode: boolean; const AOptions: TSceneLoadOptions = []); overload;

This item is declared in ancestor TCastleSceneCore.

Load the given model. This replaces RootNode with new value.

Note that you should never load the same TX3DRootNode instance into multiple TCastleScene instances.

// DON'T DO THIS!
Node := LoadNode(Url);
Scene1 := TCastleScene.Create(Application);
Scene1.Load(Node, false);
Scene2 := TCastleScene.Create(Application);
Scene2.Load(Node, false);

If you need to load the same model into multiple scenes, it is best to use the Clone method:

SceneTemplate := TCastleScene.Create(Application);
SceneTemplate.Load(Url);
Scene1 := SceneTemplate.Clone(Application);
Scene2 := SceneTemplate.Clone(Application);

Using the Clone makes a copy of the underlying X3D graph, so it is roughly like doing:

Node := LoadNode(Url);
Scene1 := TCastleScene.Create(Application);
Scene1.Load(Node.DeepCopy as TX3DRootNode, false);
Scene2 := TCastleScene.Create(Application);
Scene2.Load(Node.DeepCopy as TX3DRootNode, false);

Note that sometimes you don't need to create multiple scenes to show the same model many times. You can simply insert the same TCastleScene instance multiple times to TCastleViewport.Items (TCastleRootTransform). See the manual: https://castle-engine.io/manual_scene.php#section_many_instances

Parameters
ARootNode
The model to load. This will become a new value of our RootNode property.
AOwnsRootNode
Should the scene take care of freeing this root node when it is no longer used. If False, you are expected to free it yourself, but only after the scene using it was freed.
AResetTime
If True then we will reset time at loading (using ResetTimeAtLoad), changing the Time. This is usually what you want when you load a new world.

Source: scene/castlescenecore.pas (line 1032).

Public procedure Load(const AUrl: String; const AOptions: TSceneLoadOptions = []); overload;

This item is declared in ancestor TCastleSceneCore.

Load the 3D model from given URL.

We load a number of 3D model formats (X3D, VRML, Collada, Wavefront OBJ...) and some 2D model formats (Spine JSON). See https://castle-engine.io/creating_data_model_formats.php for the complete list.

URL is downloaded using the CastleDownload unit, so it supports files, http resources and more. See https://castle-engine.io/url about supported URL schemes. If you all you care about is loading normal files, then just pass a normal filename (absolute or relative to the current directory) as the URL parameter.

Source: scene/castlescenecore.pas (line 1049).

Public procedure Load(const AUrl: String; const AllowStdIn: boolean; const AResetTime: boolean = true); overload; deprecated 'use Load with (AUrl: String, AOptions: TSceneLoadOptions) parameters. AllowStdIn is not implemented anymore.';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Load with (AUrl: String, AOptions: TSceneLoadOptions) parameters. AllowStdIn is not implemented anymore.

This item has no description.

Source: scene/castlescenecore.pas (line 1050).

Public procedure Save(const AUrl: String);

This item is declared in ancestor TCastleSceneCore.

Save the current 3D model (X3D nodes graph) to the given file (URL).

The X3D encoding is automatically guessed from the URL extension. By default it is XML, and we suggest using the .x3d extension. If you specify an extension indicating "classic encoding", we will use such encoding (use .x3dv for X3D in classic encoding, or .wrl for older VRML content).

The file may also be automatically gzip compressed if extension indicates it. Use .x3d.gz to indicated XML compressed with gzip, or use .x3dv.gz or .wrl.gz to indicate classic encoding compressed with gzip.

The Url property is also changed.

Source: scene/castlescenecore.pas (line 1067).

Public procedure BeforeDestruction; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1069).

Public function ShapeBoundingBox(const Node: TAbstractShapeNode): TBox3D;

This item is declared in ancestor TCastleSceneCore.

Bounding box of the given shape (TAbstractShapeNode). The shape node may be used multiple times in the nodes graph (in RootNode), in which case this method correctly (and fast) sums bounding box of all the occurrences of the given shape node.

Source: scene/castlescenecore.pas (line 1081).

Public function ShapesActiveCount: Cardinal;

This item is declared in ancestor TCastleSceneCore.

Number of active shapes in the Shapes tree. This is equivalent to Shapes.ShapesCount(true), except that this is faster (it's cached and reused in this instance, and automatically invalidated only when needed).

Source: scene/castlescenecore.pas (line 1087).

Public function ShapesActiveVisibleCount: Cardinal;

This item is declared in ancestor TCastleSceneCore.

Number of active and visible (TShape.Visible) shapes in the Shapes tree.

See also
ShapesActiveCount
Number of active shapes in the Shapes tree.

Source: scene/castlescenecore.pas (line 1093).

Public function VerticesCount: Cardinal; overload;

This item is declared in ancestor TCastleSceneCore.

Calculate the number of triangls and vertexes of all shapa states. For detailed specification of what these functions do see appropriate TAbstractGeometryNode methods. Here, we just sum their results for all shapes.

Source: scene/castlescenecore.pas (line 1100).

Public function TrianglesCount: Cardinal; overload;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1101).

Public function ViewpointsCount: Cardinal;

This item is declared in ancestor TCastleSceneCore.

Number of viewpoints (named camera position+orientation). -1 if none.

Source: scene/castlescenecore.pas (line 1106).

Public function GetViewpointNode(const Idx: integer): TAbstractViewpointNode;

This item is declared in ancestor TCastleSceneCore.

Viewpoint node (TAbstractViewpointNode) from an index between 0 and ViewpointsCount.

Source: scene/castlescenecore.pas (line 1109).

Public function GetViewpointName(const Idx: integer): String;

This item is declared in ancestor TCastleSceneCore.

Good name to show user for a viewpoint, defined by an index between 0 and ViewpointsCount.

Source: scene/castlescenecore.pas (line 1112).

Public procedure MoveToViewpoint(const Idx: integer; const Animated: boolean = true);

This item is declared in ancestor TCastleSceneCore.

Move current camera of the enclosing TCastleViewport to reflect the given viewpoint. This changes the camera position and orientation.

In X3D terminology, the new viewpoint node becomes "bound" (current). Switching the viewpoint that is already bound (current) also has an effect, it will change the camera position and orientation to reflect the viewpoint defined position / orientation.

Source: scene/castlescenecore.pas (line 1121).

Public procedure AddViewpointFromNavigation(const Navigation: TCastleNavigation; const AName: String);

This item is declared in ancestor TCastleSceneCore.

Add to scene nodes (graph in RootNode) new viewpoint node reflecting current camera and navigation settings. The new viewpoint increases ViewpointsCount, so it's also immediately available for switching to it.

Source: scene/castlescenecore.pas (line 1127).

Public procedure NodeFreeRemovingFromAllParents(Node: TX3DNode);

This item is declared in ancestor TCastleSceneCore.

Call Node.FreeRemovingFromAllParents, making sure that changes to our VRML/X3D node graph are allowed. This makes sure we call BeforeNodesFree befor freeing, and ChangedAll afterwards.

This avoids a common pitfall with relying on TShape or such existence between BeforeNodesFree and ChangedAll. BeforeNodesFree may free all our TShape instances, so if you want to free TX3DNode from our graph — you typically want to get this TX3DNode instance *before* calling BeforeNodesFree. Using this method to free the node ensures this.

Source: scene/castlescenecore.pas (line 1161).

Public procedure RemoveShape(Shape: TShape);

This item is declared in ancestor TCastleSceneCore.

Remove the shape node from the scene. In case of VRML 1.0 / Inventor, when the Shape doesn't have a node, we remove the geometry node.

Source: scene/castlescenecore.pas (line 1166).

Public procedure ChangedAll(const OnlyAdditions: Boolean = false); override;

This item is declared in ancestor TCastleSceneCore.

Notify scene that potentially everything changed in the VRML/X3D graph. This includes adding/removal of some nodes within RootNode graph and changing their fields' values. (Before freeing the nodes, remember to also call BeforeNodesFree earlier.)

You usually never need to call this method explicitly. It's called by engine when necesssary. However, you need to call it yourself if you change the X3D graph directly through nodes' FdXxx fields, and you don't want to call for some reason FdXxx.Changed.

ChangedAll causes recalculation of all things dependent on RootNode, so it's very costly to call this. Avoid calling this. When you change a simple field, like by FdXxx.Value := ..., you should rather call FdXxx.Changed, and it may do something much faster than rebuilding the scene.

Descendant implementors notes: ChangedAll is virtual, when overriding it remember that it's called by constructor of this class, so you can put a lot of your initialization there (instead of in the constructor).

ChangedAll calls BeforeNodesFree(true) first, for safety (and TGLShape actually depends on it, see implementation comments).

Source: scene/castlescenecore.pas (line 1193).

Public procedure DoViewpointsChanged;

This item is declared in ancestor TCastleSceneCore.

Call OnViewpointsChanged, if assigned.

Source: scene/castlescenecore.pas (line 1266).

Public procedure DoBoundViewpointVectorsChanged;

This item is declared in ancestor TCastleSceneCore.

Call OnBoundViewpointVectorsChanged, if assigned.

Source: scene/castlescenecore.pas (line 1269).

Public procedure DoBoundNavigationInfoFieldsChanged; virtual;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1273).

Public procedure ScheduleChangedAll(const OnlyAdditions: Boolean = false);

This item is declared in ancestor TCastleSceneCore.

Mechanism to schedule ChangedAll calls.

Since these calls may be costly (traversing the hierarchy), and their results are often not immediately needed by TCastleSceneCore or TX3DNode hierarchy, it's sometimes not desirable to call them immediately when geometry changed / all changed.

So you can use ScheduleChangedAll instead of ChangedAll. All event handlers within TCastleSceneCore already do this.

When you're within Begin/EndChangesSchedule, then ScheduleChangedAll just sets an internal flag and actual ChangedAll will be done only once at EndChangesSchedule. Otherwise (when not within Begin/EndChangesSchedule), ScheduleChangedAll will immediately call ChangedAll.

Source: scene/castlescenecore.pas (line 1293).

Public procedure BeginChangesSchedule;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1294).

Public procedure EndChangesSchedule;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1295).

Public function Info( ATriangleVerticesCounts, ABoundingBox: boolean; AManifoldAndBorderEdges: boolean): String; deprecated 'do not use this, better to construct a summary string yourself';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: do not use this, better to construct a summary string yourself

Returns short information about the scene. This consists of a few lines, separated by newlines. Last line also ends with CastleUtils.NL.

Source: scene/castlescenecore.pas (line 1301).

Public function InfoTriangleVerticesCounts: String; deprecated 'better to construct a string yourself, use TrianglesCount, VerticesCount';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: better to construct a string yourself, use TrianglesCount, VerticesCount

This item has no description.

Source: scene/castlescenecore.pas (line 1306).

Public function InfoBoundingBox: String; deprecated 'better to construct a string yourself, use BoundingBox.ToString';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: better to construct a string yourself, use BoundingBox.ToString

This item has no description.

Source: scene/castlescenecore.pas (line 1308).

Public function InfoManifoldAndBorderEdges: String; deprecated 'better to construct a string yourself, use EdgesCount';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: better to construct a string yourself, use EdgesCount

This item has no description.

Source: scene/castlescenecore.pas (line 1310).

Public function InternalDetectedWholeSceneManifold( const ForceRecalculation: Boolean = false): Boolean;

This item is declared in ancestor TCastleSceneCore.

Is this scene detected as "whole scene is manifold", so some shapes are not 2-manifold but whole scene is 2-manifold. This is independent (doesn't take into account) the value of RenderOptions.WholeSceneManifold.

Source: scene/castlescenecore.pas (line 1318).

Public procedure EdgesCount(out ManifoldEdges, BorderEdges: Cardinal);

This item is declared in ancestor TCastleSceneCore.

Edges count in the scene, for information purposes.

Source: scene/castlescenecore.pas (line 1322).

Public function InternalOctreeRendering: TShapeOctree;

This item is declared in ancestor TCastleSceneCore.

A spatial structure containing all visible shapes. Set PreciseCollisions to True to have this non-nil.

This is used internally for "frustum culling", it will be automatically used by TCastleScene rendering to speed it up. You should not need to use this directly.

This octree will be automatically updated on dynamic scenes (when e.g. animation moves some shape by changing it's transformation).

Note that when VRML/X3D scene contains Collision nodes, this octree contains the visible (not necessarily collidable) objects.

Source: scene/castlescenecore.pas (line 1361).

Public function InternalOctreeDynamicCollisions: TShapeOctree;

This item is declared in ancestor TCastleSceneCore.

A spatial structure containing all collidable shapes (and then collidable triangles for a specifc shape). Set PreciseCollisions to True to have this non-nil.

This is actually a hierarchy of octrees: scene is partitioned first into Shapes (each instance of VRML/X3D geometry node), and then each Shape has an octree of triangles inside. Thanks to this, merely transforming some Shape means that only one item needs to be moved in the top-level shape tree. So this is the most important structure for collision detection on dynamic scenes.

This octree is useful for all kinds of collision detection. This is automatically used by the XxxCollision methods in this class.

You should not usually use this directly. Instead use TCastleViewport and then use Viewport.Items.WorldXxxCollision methods like Viewport.Items.WorldRay or Viewport.Items.WorldSphereCollision.

Note that when VRML/X3D scene contains Collision nodes, this octree contains the collidable (not necessarily rendered) objects.

This is kept up-to-date automatically when the scene changes. TODO: Temporarily, this is updated simply by rebuilding.

Source: scene/castlescenecore.pas (line 1389).

Public function InternalOctreeCollisions: TBaseTrianglesOctree;

This item is declared in ancestor TCastleSceneCore.

Octree for collisions.

This is equal to InternalOctreeDynamicCollisions now as we don't have other ways to check for collisions. Set PreciseCollisions to True to have this non-nil.

You should not usually use this directly. Instead use TCastleViewport and then use Viewport.Items.WorldXxxCollision methods like Viewport.Items.WorldRay or Viewport.Items.WorldSphereCollision.

Source: scene/castlescenecore.pas (line 1402).

Public function UseInternalOctreeCollisions: boolean;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1404).

Public function GetViewpoint( out ProjectionType: TProjectionType; out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: String = ''): TAbstractViewpointNode;

This item is declared in ancestor TCastleSceneCore.

Viewpoint defined in the 3D file (or some default camera settings if no viewpoint is found).

GetViewpoint seeks for VRML/X3D nodes like Viewpoint, OrthoViewpoint (actually, any X3DViewpointNode) and VRML 1.0 PerspectiveCamera and OrthographicCamera. GetPerspectiveViewpoint seeks only for perspective viewpoints.

If ViewpointDescription = '', they return the first found viewpoint node. Otherwise, they look for X3DViewpointNode with description field mathing given string.

If camera properties were found in some node, it returns this node. Otherwise it returns nil. This way you can optionally extract some additional info from used viewpoint node, or do something special if default values were used. Often you will just ignore result of this function — after all, the most important feature of this function is that you don't have to care about details of dealing with camera node.

Returned CamDir and CamUp and GravityUp are always normalized — reasons the same as for TAbstractViewpointNode.GetView.

Source: scene/castlescenecore.pas (line 1431).

Public function GetPerspectiveViewpoint( out CamPos, CamDir, CamUp, GravityUp: TVector3; const ViewpointDescription: String = ''): TAbstractViewpointNode;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1437).

Public procedure UnregisterScene(Node: TX3DNode); deprecated 'use Node.UnregisterScene';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Node.UnregisterScene

Recursively unset node's TX3DNode.Scene.

Source: scene/castlescenecore.pas (line 1448).

Public function Press(const Event: TInputPressRelease): boolean; override;

This item is declared in ancestor TCastleSceneCore.

Scene processes X3D key sensor nodes here, https://castle-engine.io/x3d_implementation_keydevicesensor.php . Remember to set ListenPressRelease to process the key sensor nodes.

Source: scene/castlescenecore.pas (line 1453).

Public function Release(const Event: TInputPressRelease): boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1454).

Public function PointingDevicePress(const Pick: TRayCollisionNode; const Distance: Single): Boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description. Showing description inherited from TCastleTransform.PointingDevicePress.

Pointing device (mouse or touch) events, you can override these to handle pointing device events. These methods are automatically called by the TCastleViewport. They are exposed here only to allow overriding them. Return True if you handled the event.

  • PointingDevicePress signals that the picking button (usually, left mouse button) was pressed.

    Note that the exact key or mouse responsible for this is configurable in our engine by Input_Interact. By default it's the left mouse button, as is usual for VRML/X3D browsers. But it can be configured to be other mouse button or a key, for example most 3D games use "e" key to interact.

  • PointingDeviceRelease signals that the picking button is released.

    An extra parameter CancelAction indicates whether this pointing device "press and release" sequence may be considered a "click". When CancelAction = True, then you should not make a "click" event (e.g. TouchSensor should not send touchTime event etc.).

  • PointingDeviceMove signals that pointer moves over this object.

They receive Pick information (TRayCollisionNode) about what exactly is hit by the 3D ray corresponding to the current pointing device position. It contains the detailed information about the point, triangle and ray (all in local coordinate system of this TCastleTransform) that are indicated by the pointing device. TRayCollisionNode.Triangle is Nil when it was not possible to determine, and TRayCollisionNode.Point is undefined in this case.

They also receive Distance to the collision point, in world coordinates. See TRayCollision.Distance. The Distance may be MaxSingle when it was not possible to determine.

There is a concept of a TCastleTransform that is currently "capturing" the pointing device events. Once TCastleTransform handles TCastleTransform.PointingDevicePress (returns True for it), it captures the following PointingDeviceMove and PointingDeviceRelease events, regardless if ray still hits this TCastleTransform instance. The "capturing" instance of TCastleTransform is informed first about pointing device move/release.

After the "capturing" instance, every pointing device event (press, release or move) is send to the leaf in TCastleTransform hierarchy (usually a TCastleScene) that is under the mouse/touch position. If the event is not handled, it is passed to other objects under the mouse/touch position.

The PointingDeviceMove event is also always passed to TCastleRootTransform.MainScene at the end (if it wasn't already the "capturing" transform, or under the mouse/touch position). This way TCastleRootTransform.MainScene is always informed about pointing device movement.

These methods are called only if the object Exists. There's no need to check this condition inside the method implementation.

Source: scene/castlescenecore.pas (line 1456).

Public function PointingDeviceRelease(const Pick: TRayCollisionNode; const Distance: Single; const CancelAction: Boolean): Boolean; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1458).

Public function PointingDeviceMove(const Pick: TRayCollisionNode; const Distance: Single): boolean; override;

This item is declared in ancestor TCastleSceneCore.

Called when pointing device moves. This may generate the continuously-generated events like hitPoint_changed, also it updates PointingDeviceOverItem and PointingDeviceOverPoint, thus producing isOver and such events.

For pointing device sensors to work, you must have collision structures set up by setting PreciseCollisions to True.

Source: scene/castlescenecore.pas (line 1469).

Public function PointingDeviceSensors: TPointingDeviceSensorList;

This item is declared in ancestor TCastleSceneCore.

Pointing-device sensors over which the pointing device is. This is just a shortcut for PointingDeviceOverItemˆ.State.PointingDeviceSensors, returning Nil if PointingDeviceOverItem = Nil.

Source: scene/castlescenecore.pas (line 1490).

Public procedure PointingDeviceClear;

This item is declared in ancestor TCastleSceneCore.

Clear any references to PTriangle passed previously in TRayCollisionNode argument to PointingDevicePress, PointingDeviceRelease, PointingDeviceMove. This is internally used in case some of past seen PTriangle may become invalid, so any memory about them should be cleared.

This doesn't cause any X3D events (contrary to e.g. calling PointingDeviceMove with Pick.Triangle = Nil).

This method clears any references to saved PTriangle and PointingDeviceActiveSensors. Note that this still calls DoPointingDeviceSensorsChange (making OnPointingDeviceSensorsChange event), if PointingDeviceActiveSensors / PointingDeviceSensors possibly changed.

Source: scene/castlescenecore.pas (line 1520).

Public function LocalBoundingBox: TBox3D; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description. Showing description inherited from TCastleTransform.LocalBoundingBox.

Bounding box of this object, ignoring the transformations of this scene and parents.

Source: scene/castlescenecore.pas (line 1533).

Public procedure SetTime(const NewValue: TFloatTime);

This item is declared in ancestor TCastleSceneCore.

Change current scene time, setting Time. This causes time to be passed to appropriate time-dependent nodes, events will be called etc.

You must call this continuously to have time-dependent features working, like TTimeSensorNode nodes inside the scene (driving all animations) and TMovieTextureNode. See Time for details what is affected by this.

This is automatically called if you added this scene to TCastleViewport.Items. Then our TCastleViewport takes care of calling our Update which in turn will call this method (and account for TimePlaying and TimePlayingSpeed).

SetTime and IncreaseTime do exactly the same, the difference is only that for IncreaseTime you specify increase in the time (that is, NewTime = Time + TimeIncrease). Use whichever version is more handy.

Following X3D specification, time should only grow. So NewValue should be > Time (or TimeIncrease > 0). Otherwise we ignore this call. For resetting the time (when you don't necessarily want to grow Time) see ResetTime.

If a change of Time will produce some visible change in the model (for example, MovieTexture will change, or TimeSensor change will be routed by interpolator to coordinates of some visible node) it will be reported by usual method, that is VisibleChangeHere.

Source: scene/castlescenecore.pas (line 1567).

Public procedure IncreaseTime(const TimeIncrease: TFloatTime);

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1568).

Public procedure IncreaseTimeTick; deprecated 'it should not be necessary to call this, ever; using TX3DEvent.Send(...) or TX3DEvent.Send(..., NextEventTime) will automatically behave Ok.';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: it should not be necessary to call this, ever; using TX3DEvent.Send(...) or TX3DEvent.Send(..., NextEventTime) will automatically behave Ok.

This item has no description.

Source: scene/castlescenecore.pas (line 1571).

Public function Time: TFloatTime; override;

This item is declared in ancestor TCastleSceneCore.

Current time within this scene, in seconds. Increasing this "drives" the animations (by increasing time of time-dependent nodes like TTimeSensorNode, which in turn drive the rest of the animation).

You can use SetTime or IncreaseTime to move time forward manually. But usually there's no need for it: our Update method takes care of it automatically, you only need to place the scene inside TCastleViewport.Items.

You can start/stop time progress by TimePlaying and scale it by TimePlayingSpeed. These properties affect how the time is updated by the Update method (so if you use SetTime or IncreaseTime methods, you're working around these properties).

Default time value is 0.0 (zero). However it will be reset at load to a current time (seconds since Unix epoch — that's what X3D standard says to use, although you can change it by TNavigationInfoNode.timeOriginAtLoad, see https://castle-engine.io/x3d_time_origin_considered_uncomfortable ). You can perform this "time reset" yourself by ResetTimeAtLoad or ResetTime.

Source: scene/castlescenecore.pas (line 1597).

Public function NextEventTime: TX3DTime; override;

This item is declared in ancestor TCastleSceneCore.

Time that should be used for next event. You usually don't need to call this directly, this is automatically used by TX3DEvent.Send when you don't specify explicit time.

Source: scene/castlescenecore.pas (line 1602).

Public procedure ResetTime(const NewValue: TFloatTime);

This item is declared in ancestor TCastleSceneCore.

Set Time to an arbitrary value.

You should only use this when you loaded new model. It is automatically called by Load so in practice you don't need to call this yourself.

Unlike SetTime and IncreaseTime, this doesn't require that Time grows. It still does some time-dependent events work, although some time-dependent nodes may be just unconditionally reset by this to starting value (as they keep local time, and so require TimeIncrease notion, without it we can only reset them).

Source: scene/castlescenecore.pas (line 1617).

Public procedure ResetTimeAtLoad;

This item is declared in ancestor TCastleSceneCore.

Set Time to suitable initial value after loading a world.

This honours X3D specification about the time origin, and our extensions too. See https://castle-engine.io/x3d_time_origin_considered_uncomfortable

Source: scene/castlescenecore.pas (line 1625).

Public function GetBackgroundStack: TX3DBindableStackBasic; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1669).

Public function GetFogStack: TX3DBindableStackBasic; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1670).

Public function GetNavigationInfoStack: TX3DBindableStackBasic; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1671).

Public function GetViewpointStack: TX3DBindableStackBasic; override;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1672).

Public procedure RegisterCompiledScript(const HandlerName: String; Handler: TCompiledScriptHandler);

This item is declared in ancestor TCastleSceneCore.

Register compiled script handler, for VRML/X3D Script node with "compiled:" protocol. See [https://castle-engine.io/x3d_extensions.php#section_ext_script_compiled].

Source: scene/castlescenecore.pas (line 1682).

Public procedure InternalUpdateNavigation( const Navigation: TCastleNavigation);

This item is declared in ancestor TCastleSceneCore.

Update TCastleNavigation properties based on currently bound TNavigationInfoNode.

Bound TNavigationInfoNode is taken from NavigationInfoStack.Top. If no such node is bound (NavigationInfoStack.Top is Nil) then we behave as if TNavigationInfoNode with all fields at default was active.

Note that, since some fields are only in some descendants (e.g. MoveSpeed is only at TCastleWalkNavigation) then some TNavigationInfoNode settings are just not transferred to all Navigation instances like TCastleExamineNavigation

Source: scene/castlescenecore.pas (line 1695).

Public procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp)

Make Camera go to the view given by (world coordinates) APosition, ADirection, AUp.

Honours current NavigationInfo.transitionType and transitionTime. If transitionType indicates instanteneous transition, then jumps by simple Camera.SetWorldView(APosition, ADirection, AUp). Otherwise makes a smooth animation into new values by Camera.AnimateTo(APosition, ADirection, AUp, TransitionTime).

Will generate NavigationInfo.transitionComplete when transition ends.

Source: scene/castlescenecore.pas (line 1748).

Public procedure CameraTransition(const Camera: TCastleCamera; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp)

This item has no description.

Source: scene/castlescenecore.pas (line 1750).

Public procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp)

This item has no description.

Source: scene/castlescenecore.pas (line 1752).

Public procedure CameraTransition(const Navigation: TCastleNavigation; const APosition, ADirection, AUp, GravityUp: TVector3); overload; deprecated 'use Camera.AnimateTo(APosition, ADirection, AUp)';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: use Camera.AnimateTo(APosition, ADirection, AUp)

This item has no description.

Source: scene/castlescenecore.pas (line 1754).

Public function CustomHeadlight: TAbstractLightNode;

This item is declared in ancestor TCastleSceneCore.

Light node that should be used for headlight, or Nil if default directional headlight is suitable.

This never returns Nil. It's not concerned whether the headlight should actually be used — for this, see HeadlightOn.

Source: scene/castlescenecore.pas (line 1784).

Public function Caption: String;

This item is declared in ancestor TCastleSceneCore.

Nice scene caption. Uses the "title" of WorldInfo node inside the VRML/X3D scene. If there is no WorldInfo node (or it has empty title) then result is based on loaded URL.

Source: scene/castlescenecore.pas (line 1813).

Public function Node(const NodeClass: TX3DNodeClass; const NodeName: String; const Options: TFindNodeOptions = []): TX3DNode; overload;

This item is declared in ancestor TCastleSceneCore.

Find a named X3D node in the current node graph.

By default it searches both active and inactive graph parts. Add fnOnlyActive to search only in active parts.

It searches only within nodes of given type (NodeClass). Specifying NodeClass helps to make search unambiguous (as name clashes are possible, some authoring tools may write models with duplicate names for materials, meshes etc. and both glTF and X3D allow it). This allows to safely write code like:

MyMaterial := Scene.Node(TNodePhysicalMaterial, 'MyMaterial') as TNodePhysicalMaterial;

TODO: An even better version, "MyMaterial := Scene.Node<TNodePhysicalMaterial>('MyMaterial')", may be available in the future, if FPC support for generic methods will improve. Define GENERIC_METHODS to try it out now, but heed the warnings in castleconf.inc .

Exceptions raised
EX3DNotFound
When node is not found. Unless fnNilOnMissing in Options, then it returns Nil on missing node, and EX3DNotFound is never raised.

Source: scene/castlescenecore.pas (line 1842).

Public function Node(const NodeName: String): TX3DNode; overload;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1844).

Public function Field(const NodeName, FieldName: String): TX3DField; overload;

This item is declared in ancestor TCastleSceneCore.

Find a named field within an X3D node in the current node graph.

Like Node, this searches all nodes (in active or not) graph parts.

Exceptions raised
EX3DNotFound
If given node or field could not be found.

Source: scene/castlescenecore.pas (line 1856).

Public function Event(const NodeName, EventName: String): TX3DEvent; overload;

This item is declared in ancestor TCastleSceneCore.

Find a named event within an X3D node in the current node graph.

Like Node, this searches all nodes (in active or not) graph parts.

Exceptions raised
EX3DNotFound
If given node or event could not be found.

Source: scene/castlescenecore.pas (line 1864).

Public function HasAnimation(const AnimationName: String): boolean;

This item is declared in ancestor TCastleSceneCore.

Does named animation with given name exist.

See also
AnimationsList
List the names of available animations in current scene.
PlayAnimation

Source: scene/castlescenecore.pas (line 1920).

Public function AnimationTimeSensor(const AnimationName: String): TTimeSensorNode; overload;

This item is declared in ancestor TCastleSceneCore.

TimeSensor of this animation. Nil if this name not found.

Source: scene/castlescenecore.pas (line 1923).

Public function AnimationTimeSensor(const Index: Integer): TTimeSensorNode; overload;

This item is declared in ancestor TCastleSceneCore.

TimeSensor of this animation, by animation index (index on AnimationsList). Nil if this index not found.

Source: scene/castlescenecore.pas (line 1927).

Public function ForceAnimationPose(const AnimationName: String; const TimeInAnimation: TFloatTime; const Loop: boolean; const Forward: boolean = true): boolean; overload;

This item is declared in ancestor TCastleSceneCore.

Forcefully, immediately, set pose from given animation, with given time in animation.

This avoids the normal passage of time in X3D scenes, it ignores the ProcessEvents and AnimateOnlyWhenVisible properties, it ignores the current animation set by PlayAnimation, and forces the current time on TimeSensors by TTimeSensorNode.FakeTime.

Source: scene/castlescenecore.pas (line 1936).

Public function PlayAnimation(const Parameters: TPlayAnimationParameters): boolean; overload;

This item is declared in ancestor TCastleSceneCore.

Play an animation specified by name.

You can specify the animation name, whether it should loop, and whether to play it forward or backward using parameters to this method.

Or you can specify even more parameters using TPlayAnimationParameters instance. TPlayAnimationParameters can additionally specify a stop notification, initial time and more. It is OK to create a short-lived TPlayAnimationParameters instance and destroy it right after calling this method. This method doesn't store the TPlayAnimationParameters instance reference.

To get the list of available animations, see AnimationsList.

This is one of the simplest way to play animations using Castle Game Engine. Alternative (that calls PlayAnimation under the hood) is to set AutoAnimation. See https://castle-engine.io/viewport_3d#_play_animation .

Playing an already-playing animation is guaranteed to restart it from the beginning (more precisely: from TPlayAnimationParameters.InitialTime, if you pass TPlayAnimationParameters).

If the given animation name exists, then we stop previously playing animation (if any), calling it's stop notification (see TPlayAnimationParameters.StopNotification), start playing the new animation, and return True. If the animation name does not exist then we return False, make a warning and the current animation is unchanged.

The change from previous to new animation can be smooth (using animation cross-fading) if you use TPlayAnimationParameters with TPlayAnimationParameters.TransitionDuration or if you set DefaultAnimationTransition to something non-zero.

This automatically turns on ProcessEvents, if it wasn't turned on already. Processing events is necessary for playing animations.

More details about how this works:

  • Calling this method does not change the scene immediately. There may be a delay between calling PlayAnimation and actually changing the scene to reflect the state at the beginning of the indicated animation. This delay is usually 1 frame (that is, the scene is updated at the next Update call), but it may be larger if you use the optimization AnimateSkipTicks.

    This is often a desirable optimization. There's often no "rush" to visually change the animation right now, and doing it at the nearest Update call is acceptable. It also means that calling PlayAnimation multiple times before a single Update call is not expensive.

    If you really need to change the scene immediately (for example, because you don't want to show user the initial scene state), simply call ForceInitialAnimationPose right after PlayAnimation.

  • The animation is performed using X3D TTimeSensorNode.

    For example, TTimeSensorNode may instruct a TCoordinateInterpolatorNode to update the TIndexedFaceSetNode coordinates, and in effect the animation can deform a mesh. Or TTimeSensorNode may instruct a TPositionInterpolatorNode to update TTransformNode.Translation, and in effect the animation can move something. See https://castle-engine.io/x3d_implementation_interpolation.php for a thorough description how the animation works in X3D.

    This means that during the animation, the X3D nodes graph (within RootNode) is being changed.

    If you load a model from a castle-anim-frames or MD3 format, note that it is animated using a special "node interpolator". This also works using a special (internal) X3D node that switches which node is visible.

  • Starting an animation effectively cancels any effect from any previous animation. That is, even if the new animation doesn't modify some transformations, these transformations are not left "as is", instead they are reset to the default model state using ResetAnimationState. This is usually the desired effect, corresponding to how the animations should intuitively behave, e.g. if you have "walk" and "idle" animations.

    If you want to simultaneously play multiple animations or if you want to simultaneously modify scene by code (while playing some animation) then you can control each time sensor using TTimeSensorNode.Start and TTimeSensorNode.Stop. See also the example in examples/animations/simultaneous_animations_one_scene .

Source: scene/castlescenecore.pas (line 2034).

Public function PlayAnimation(const AnimationName: String; const Loop: boolean; const Forward: boolean = true): boolean; overload;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 2035).

Public procedure ForceInitialAnimationPose;

This item is declared in ancestor TCastleSceneCore.

Force the model to look like the initial animation frame now.

Use this after calling PlayAnimation. Calling this is simply ignored if no PlayAnimation was called earlier, of if the model already looks following the animation requested by PlayAnimation.

If you don't use this method, there may be a 1-frame delay between calling PlayAnimation and actually updating the rendered scene look. If during that time a rendering will happen, the user will see a scene in previous pose (not in the first pose of animation you requested by PlayAnimation). To avoid this, simply call this method right after PlayAnimation.

This sets first animation frame, unless you used TPlayAnimationParameters.InitialTime <> 0.

Source: scene/castlescenecore.pas (line 2054).

Public function AnimationDuration(const AnimationName: String): TFloatTime;

This item is declared in ancestor TCastleSceneCore.

Duration, in seconds, of the named animation (named animations are detected by AnimationsList method). For a looping animation, this is the duration of a single cycle. 0 if not found.

Source: scene/castlescenecore.pas (line 2060).

Public procedure StopAnimation(const DisableStopNotification: Boolean = false);

This item is declared in ancestor TCastleSceneCore.

Stop the CurrentAnimation, started by last PlayAnimation call. Note that this leaves the model in a state in the middle of the last animation.

You can use ResetAnimationState to reset the state afterwards. Calling ForceInitialAnimationPose also will do it.

Note that it is not necessary to stop the previous animation before starting a new one (by PlayAnimation). PlayAnimation will automatically stop the previous animation. Moreover, PlayAnimation may do animation blending (cross-fade) between old and new animation (if you use TPlayAnimationParameters.TransitionDuration), which only works if you did not call StopAnimation.

When animation is stopped (by this or any other means), by default it's TPlayAnimationParameters.StopNotification is called. You can use DisableStopNotification to avoid it, which should be used only in exceptional situations.

Source: scene/castlescenecore.pas (line 2110).

Public procedure ResetAnimationState(const IgnoreAffectedBy: TTimeSensorNode = nil);

This item is declared in ancestor TCastleSceneCore.

Reset all the fields affected by animations. See TimeSensor.detectAffectedFields documentation (https://castle-engine.io/x3d_implementation_time_extensions.php#section_detect_affected_fields) for details how these fields are detected, and when this is useful. By default this is enabled, for all TimeSensor nodes.

If IgnoreAffectedBy <> nil, the fields affected by the given TimeSensor may not be reset. This is an optimization useful in case this TimeSensor will modify the scene very soon, so resetting its affected fields is a waste of time. Do not depend on 100% that the fields affected by given TimeSensor are left untouched (in the current implementation, this field is ignored).

Source: scene/castlescenecore.pas (line 2124).

Public procedure FontChanged;

This item is declared in ancestor TCastleSceneCore.

Force recalculating the text shapes when font changed. For now, we don't detect font changes (e.g. when TFontStyleNode.CustomFont changed) automatically. This calls TTextNode.FontChanged and TAsciiTextNode_1.FontChanged on all appropriate nodes.

Source: scene/castlescenecore.pas (line 2131).

Public procedure InternalIncShapesHash;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 2149).

Public procedure ReloadUrl;

This item is declared in ancestor TCastleSceneCore.

Load again the model from current URL. This makes sense to be used when underlying file on disk changed, and you want to reload it.

TODO: If the file is cached using Cache, then it will not reload the version in cache, so effectively it will not load new version from disk. This will be fixed at some point.

Source: scene/castlescenecore.pas (line 2159).

Protected function EffectiveRenderOptions: TCastleRenderOptions; override;

This item has no description. Showing description inherited from TCastleSceneCore.EffectiveRenderOptions.

Render options used to render this scene, Nil for TCastleSceneCore itself. Use descendant TCastleScene to get non-Nil value.

Source: scene/castlescene.pas (line 338).

Protected function CreateShape(const AGeometry: TAbstractGeometryNode; const AState: TX3DGraphTraverseState; const ParentInfo: PTraversingInfo): TShape; override;

This item has no description. Showing description inherited from TCastleSceneCore.CreateShape.

Create TShape (or descendant) instance suitable for this TCastleSceneCore descendant. In this class, this simply creates new TShape instance. If you make a descendant of TCastleSceneCore, you may need to store some per-shape information, and then it may be useful to have your own TShape descendant to carry this information. So you can override this to create your own descendant, and then you're sure that all leafs within Shapes tree are created using this.

Example: TCastleScene uses this to create TGLShape.

Source: scene/castlescene.pas (line 340).

Protected procedure LocalRender(const Params: TRenderParams); override;

This item has no description. Showing description inherited from TCastleTransform.LocalRender.

Collect the things to be rendered now.

Override this method if you need to perform custom rendering, by direct OpenGL(ES) calls. Never call this method yourself – the rendering of TCastleViewport will call it when needed.

Warning: It is an advanced topic how to make such rendering work, and make it work in a cross-platform way. You will need to understand how OpenGL(ES) works, and you will need to account for how the engine renders things too, to not conflict with the engine – e.g. you will have to use RenderContext for some things. If you're not ready for this, then you're better off not overriding this method, instead just rely on the engine built-in rendering, done by TCastleScene and other components.

This method gets parameters (Params) including a full transformation of this scene.

In return, it should add the things to be rendered in this frame using Params.AddRenderEvent.

Internally: TCastleScene also adds X3D shapes to be rendered to TRenderParams.Collector. But you should not need to deal with TRenderParams.Collector in your own code.

TODO: The names LocalRender, TRenderParams are now confusing. LocalRender is not a method where one should "render" anymore. It's a "collection phase". Think of it as "TCastleTranssform.CollectThingsToRender(const Params: ...)" and bear with us as we figure out a non-confusing naming around this.

Source: scene/castlescene.pas (line 347).

Protected procedure LocalRenderShadowVolume(const Params: TRenderParams; const ShadowVolumeRenderer: TBaseShadowVolumeRenderer); override;

Render shadow volume (sides and caps) of this scene, for shadow volume algorithm.

Uses ShadowVolumeRenderer for rendering, and to detect if rendering is necessary at all.

It always uses silhouette optimization. This is the usual, fast method of rendering shadow volumes.

All shadow quads are generated from scene triangles transformed by ParentTransform. We must be able to correctly detect front and back facing triangles with respect to light position, so ShadowVolumeRenderer.LightPosition and "this scene transformed by ParentTransform" must be in the same coordinate system. If ParentTransformIsIdentity then ParentTransform value is ignored and everything works like ParentTransform = identity matrix (and is a little faster in this special case).

Uses TrianglesListShadowCasters and ManifoldEdges and BorderEdges (so you may prefer to prepare it before, e.g. by calling PrepareResources with prShadowVolume included).

We look at some RenderOptions, like RenderOptions.Blending, because transparent triangles have to be handled a little differently, and when RenderOptions.Blending = false then all triangles are forced to be opaque. In other words, this takes RenderOptions into account, to cooperate with our Render method.

ShadowVolumeRenderer.LightPosition is the light position. ShadowVolumeRenderer.LightPosition[3] must be 1 (to indicate positional light) or 0 (a directional light). It's expected that ShadowVolumeRenderer is already initialized by ShadowVolumeRenderer.InitFrustumAndLight.

Faces (both shadow quads and caps) are rendered such that CCW <=> you're looking at it from outside (i.e. it's considered front face of this shadow volume).

Source: scene/castlescene.pas (line 386).

Protected procedure ChangeWorld(const Value: TCastleAbstractRootTransform); override;

This item has no description. Showing description inherited from TCastleTransform.ChangeWorld.

Called when the current World that contains this object changes. In the usual case, World corresponds to a TCastleViewport.Items instance, and when this method is called it means that object is added/removed from a viewport.

You can ignore this when called with Value equal to current World.

Note that each TCastleTransform instance can only be part of one world (TCastleAbstractRootTransform) at a time. Although we may be present many times within the same world. Always remove the TCastleTransform from previous world before adding it to a new one.

Source: scene/castlescene.pas (line 389).

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Source: scene/castlescene.pas (line 391).

Public destructor Destroy; override;

This item has no description.

Source: scene/castlescene.pas (line 392).

Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;

This item has no description. Showing description inherited from TCastleTransform.Update.

Continuously occuring event, for various tasks.

Executed only on instances that have Exists (no need to check this in overridden Update implementation).

Source: scene/castlescene.pas (line 393).

Public 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.

Source: scene/castlescene.pas (line 394).

Public procedure GLContextClose; override;

Destroy any associations of this object with current OpenGL context. For example, release any allocated texture names.

Generally speaking, destroys everything that is allocated by PrepareResources call. It's harmless to call this method when there are already no associations with current OpenGL context. This is called automatically from the destructor.

Source: scene/castlescene.pas (line 403).

Public procedure PrepareResources(const Options: TPrepareResourcesOptions; const Params: TPrepareParams); override; deprecated 'this is internal; use TCastleViewport.PrepareResources to prepare transformations';

Warning: this symbol is deprecated: this is internal; use TCastleViewport.PrepareResources to prepare transformations

This item has no description. Showing description inherited from TCastleTransform.PrepareResources.

Prepare resources, making various methods (like rendering and such) to execute fast.

It is usually simpler to call TCastleViewport.PrepareResources then this method. Calling Viewport.PrepareResources(MyScene) will automatically call MyScene.PrepareResources(...) underneath, with proper parameters.

It is best to call this when the rendering context is initailized, e.g. at Application.OnInitialize or later. Calling this method before the rendering context is initialized (e.g. from initializaton section of some unit) will have to skip some preparations, thus reducing the effectiveness of this method. But it is allowed to call this at any time, regardless of the context being initialized, just like e.g. TCastleContainer.LoadSettings (which may call this, to warmup cache).

This makes sure that appropriate methods execute as fast as possible. It's never required to call this method — everything will be prepared "as needed" anyway. But if you allow everything to be prepared "as needed", then e.g. the first Render call may take a long time because it may have to prepare resources that will be reused in next Render calls. This may make your program seem slow at the beginning (when rendering resources are being prepared, so at the first frame, or a couple of first animation frames). To avoid this, call this method, showing the user something like "now we're preparing the resources — please wait".

TODO: It is not possible to call this now without TPrepareParams, and to get params you need to access deprecated TCastleViewport.PrepareParams. We advise to call TCastleViewport.PrepareResources instead. We'd like to get rid of TPrepareParams eventually.

Source: scene/castlescene.pas (line 405).

Public procedure BeforeNodesFree(const InternalChangedAll: boolean = false); override;

This item has no description. Showing description inherited from TCastleSceneCore.BeforeNodesFree.

Release all internal associations with your VRML/X3D nodes. In particular, this will release OpenGL resources connected to your nodes. You should always call this before you (may) free some nodes in RootNode.

You have to call ChangedAll or Load at sometime after BeforeNodesFree, and before you try actual rendering, events etc. Otherwise some stuff may not get recalculated.

The InternalChangedAll parameter is for internal use. It is set to True when ChangedAll calls this method at the beginning of it's work, and means that nothing is freed, and we only require necessary cleanup at the beginning of ChangedAll. This way ChangedAll (when it wasn't preceeded by explicit BeforeNodesFree(false)) produces events from stacks CheckForDeletedNodes.

Source: scene/castlescene.pas (line 409).

Public function HasColliderMesh: Boolean; override;

Does this transform have a collision mesh that TCastleMeshCollider can use.

Source: scene/castlescene.pas (line 412).

Public procedure ColliderMesh(const TriangleEvent: TTriangleEvent); override;

Enumerate triangles for a collision mesh that TCastleMeshCollider can use.

Source: scene/castlescene.pas (line 414).

Public procedure FreeResources(Resources: TSceneFreeResources); override;

This item has no description. Showing description inherited from TCastleSceneCore.FreeResources.

Frees some scene resources, to conserve memory. See TSceneFreeResources documentation.

Source: scene/castlescene.pas (line 437).

Public function Clone(const AOwner: TComponent): TCastleScene;

Create a scene with the same contents (X3D scene graph) as this one. The created scene has exactly the same class as this one (we use ClassType.Create to call a virtual constructor).

Note that this does not copy other scene properties, like ProcessEvents or RenderOptions contents.

Source: scene/castlescene.pas (line 497).

Public function WasVisible: Boolean;

Whether the scene was (potentially, at least partially) visible in the last rendering event.

The "was visible" means that "some shape was visible", that is: some shape passed frustum culling, distance culling and occlusion culling (see https://castle-engine.io/occlusion_culling ) tests.

The result of this method is not affected by:

  • Lights.

    That is, it doesn't matter whether this scene contains some lights (X3D light nodes in RootNode) that possibly make some other scenes brighter.

  • Background.

    It doesn't matter whether the scene contains some background that affects TCastleViewport skybox.

  • Children scenes.

    It doesn't matter if you have any children scenes (TCastleScene instances that are children of this) and whether they are visible. This follows the general rule that TCastleScene-specific features do not look/affect children scenes, including children TCastleScene. Only TCastleTransform features, like TCastleTransform.Exists, are applied recursively, i.e. they generally affect the children transformations.

To summarize and emphasize: for this method, only the visibility of shapes within this scene matters.

If this scene instance is used multiple times within some viewport, or when multiple viewports render the same scene, then it is enough that at least one shape in one of the scene instances was visible last frame.

TODO: For now, occlusion culling doesn't affect this, i.e. if the scene is not visible because occlusion culling.

Source: scene/castlescene.pas (line 545).

Public procedure SetEffects(const Value: array of TEffectNode);

Add shader effects to configure how is the component rendered. See https://castle-engine.io/shaders for documentation how shader effects work in Castle Game Engine.

Source: scene/castlescene.pas (line 550).

Properties

Public property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents;

This item is declared in ancestor TCastleComponent.

Components added by AddNonVisualComponent.

Source: base/castleclassutils.pas (line 698).

Public property IsLoading: Boolean read FIsLoading;

This item is declared in ancestor TCastleComponent.

Is the component during deserialization now.

Note: We can't use csLoading in ComponentState because in Delphi it is not possible to control it from CastleComponentSerialize.

Source: base/castleclassutils.pas (line 711).

Public property GetExists: Boolean read FExists; deprecated 'use Exists';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use Exists

This item has no description.

Source: transform/castletransform_transform.inc (line 717).

Public property Items[const I: Integer]: TCastleTransform read GetItem write SetItem; default;

This item is declared in ancestor TCastleTransform.

List of current children.

Source: transform/castletransform_transform.inc (line 825).

Public property Parent: TCastleTransform read FParent write SetParent;

This item is declared in ancestor TCastleTransform.

Parent TCastleTransform.

In most cases, a TCastleTransform is just a child of one other TCastleTransform, and then this property returns this natural parent.

Returns Nil if TCastleTransform is not a child of any other TCastleTransform.

Setting this property removes us from old parent, and adds to the new one. The local transformation (translation, rotation, scale) doesn't change, so changing parent may change the effective (world) transformation of the object.

In rare cases the child can have multiple parents. The behavior is then:

Source: transform/castletransform_transform.inc (line 891).

Public property UniqueParent: TCastleTransform read FParent; deprecated 'use Parent';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use Parent

This item has no description.

Source: transform/castletransform_transform.inc (line 893).

Public property CastShadowVolumes: boolean read FCastShadows write FCastShadows default true; deprecated 'use CastShadows';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use CastShadows

Does the 3D object cast shadows by shadow volumes. See also TCastleScene.ReceiveShadowVolumes.

Source: transform/castletransform_transform.inc (line 942).

Public property ListenPressRelease: Boolean read FListenPressRelease write SetListenPressRelease default false;

This item is declared in ancestor TCastleTransform.

Are Press and Release virtual methods called.

Source: transform/castletransform_transform.inc (line 1011).

Public property World: TCastleAbstractRootTransform read FWorld;

This item is declared in ancestor TCastleTransform.

Reference to the root transformation (typically matching the TCastleViewport.Items value) containing us.

May be Nil if we are not (yet) part of some hierarchy rooted in TCastleAbstractRootTransform. In simple words, it means that TCastleTransform is not added to the viewport yet.

Source: transform/castletransform_transform.inc (line 1133).

Public property WorldDirection: TVector3 read GetWorldDirection write SetWorldDirection;

This item is declared in ancestor TCastleTransform.

Our Direction, in world coordinates.

Source: transform/castletransform_transform.inc (line 1171).

Public property CollidesWithMoving: boolean read FCollidesWithMoving write FCollidesWithMoving default false;

This item is declared in ancestor TCastleTransform.

Can this object be pushed by (or block movement of) doors, elevators and other moving level parts (TCastleMoving instances).

Some 3D moving objects may try to avoid crushing this item. Like an automatic door that stops it's closing animation to not crush things standing in the doorway.

Some other 3D moving objects may push this object. Like elevators (vertical, or horizontal moving platforms). We may use sphere (see CollisionSphereRadius and Sphere) for checking collisions, or bounding box (TCastleTransform.BoundingBox), depending on need.

Source: transform/castletransform_transform.inc (line 1284).

Public property Gravity: boolean read FGravity write FGravity default false; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity

Gravity may make this object fall down (see FallSpeed) or grow up (see GrowSpeed). See also PreferredHeight.

Special notes for TPlayer: player doesn't use this (TPlayer.Gravity should remain False), instead player relies on TPlayer.Navigation.Gravity = True, that does a similar thing (with some extras, to make camera effects). This will change in the future, to merge these two gravity implementations. Although the TPlayer.Fall method still works as expected (it's linked to TCastleWalkNavigation.OnFall in this case).

Source: transform/castletransform_transform.inc (line 1436).

Public property FallSpeed: Single read FFallSpeed write FFallSpeed default 0; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity

Falling speed, in units per second, for Gravity.

This is relevant only if Gravity and PreferredHeight <> 0. 0 means no falling.

Source: transform/castletransform_transform.inc (line 1443).

Public property GrowSpeed: Single read FGrowSpeed write FGrowSpeed default 0; deprecated 'use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use physics (TCastleRigidBody, TCastleCollider) to make things affected by gravity

Growing (raising from crouching to normal standing position) speed, in units per second. This is used by non-flying creatures when climbing up stairs, in which case Translation ("legs positon") may be sometimes under the ground while Middle ("eyes position") will be always above the ground and will try to grow to be at PreferredHeight above the ground.

This is relevant only if Gravity and PreferredHeight <> 0. 0 means no growing.

Source: transform/castletransform_transform.inc (line 1455).

Public property MiddleHeight: Single read FMiddleHeight write FMiddleHeight default DefaultMiddleHeight;

This item is declared in ancestor TCastleTransform.

How high are creature eyes in the model. Value 0 means that eyes are at the bottom of the model, 0.5 means the middle, 1 means top.

The top is always considered to be at the top of the bounding box.

Definition of bottom depends on Gravity:

  • When Gravity is True, then the bottom is considered to be the plane where World.GravityCoordinate (like Z or Y axis) is zero. The actual bottom (lowest point) of the bounding box doesn't matter. This means that things placed below zero plane (like a creature tentacle or leg) will sink into the ground, instead of causing whole creature to move up. It also means that the creature can easily float above the ground, just model it a little above the zero plane.

    In other words, this allows you to model the creature with respect to the ground (zero plane), which is comfortable.

    Note that setting MiddleHeight to exact 0 means that gravity will not work, as it means that the PreferredHeight above the ground is to be stuck right at the ground level.

    For gravity to work right, the MiddleHeight should be large enough to cause PreferredHeight to be > Sphere radius, for all possible animation states (for all possible bounding box values).

  • When Gravity is False, then the bottom is considered at the bottom of the bounding box.

    This way it works regardless of where (0,0,0) is in your model (regardless if (0,0,0) represents legs, or middle of your creature), since we adjust to the BoundingBox position.

This property determines how the TCastleTransform handles the Middle implementation (this is the point used for various collision detection routines) and PreferredHeight (this is the preferred height of Middle above the ground). You can override these two methods to use a different approach, and then ignore MiddleHeight completely.

Source: transform/castletransform_transform.inc (line 1516).

Public property Translation: TVector3 read FTranslation write SetTranslation;

This item is declared in ancestor TCastleTransform.

Translation (move) the children. Zero by default.

Set it like this:

Scene.Translation := Vector3(1, 2, 3);
Scene.Translation := Scene.Translation + Vector3(4, 5, 6);

Source: transform/castletransform_transform.inc (line 1644).

Public property TranslationXY: TVector2 read GetTranslationXY write SetTranslationXY;

This item is declared in ancestor TCastleTransform.

Get or set the XY components of the translation. Useful for 2D games.

Source: transform/castletransform_transform.inc (line 1648).

Public property Center: TVector3 read FCenter write SetCenter;

This item is declared in ancestor TCastleTransform.

Center point around which the Rotation and Scale is performed.

Source: transform/castletransform_transform.inc (line 1651).

Public property Rotation: TVector4 read FRotation write SetRotation;

This item is declared in ancestor TCastleTransform.

Rotation in 3D, around a specified axis. Rotation is expressed as a 4D vector, in which the first 3 components specify the rotation axis (does not need to be normalized, but must be non-zero) and the last component is the rotation angle in radians.

Note: the Rotation axis (first 3 components) must not be a zero vector, however as a special case the rotation value TVector4.Zero (so all the components, axis and angle, are zero) is also allowed.

Rotation is done around Center (which is by default zero, so it doesn't matter).

Set the rotation like this:

Scene.Rotation := Vector4(0, 0, 1, Pi / 2);
Scene.Rotation := Vector4(0, 0, 1, Deg(90)); // Deg is a useful shortcut for DegToRad
Scene.Rotation := Scene.Rotation + Vector4(0, 0, 0, Pi / 2);

To combine multiple rotations, you can use quaternion multiplication. For example to combine a rotation around Y axis with rotation around Z axis, you can do this:

var
  Q, Q1, Q2: TQuaternion;
begin
  Q1 := QuatFromAxisAngle(Vector3(0, 1, 0), Deg(30));
  Q2 := QuatFromAxisAngle(Vector3(0, 0, 1), Deg(45));
  Q := Q1 * Q2;
  MyTransform.Rotation := Q.ToAxisAngle;
end;

Combining rotations using quaternions is very flexible. You can combine as many rotations as you want, and it is clear (you define it yourself) in which order each rotation is applied. Note that you can also just nest one TCastleTransform within another TCastleTransform, and set different rotations on each of them, to also effectively combine the rotations.

Source: transform/castletransform_transform.inc (line 1693).

Public property Scale: TVector3 read FScale write SetScale;

This item is declared in ancestor TCastleTransform.

Scale in 3D. Scaling is done around Center and with orientation given by ScaleOrientation.

We do the best we can to work with any scale value, even negative or zero. But usually, it's best to keep the scale positive. More information:

  1. If you can, keep the scale uniform, that is scale equal amount in X, Y and Z. For example set scale = (3.0, 3.0, 3.0) to scale 3x times, and avoid scale like (3.0, 1.0, 1.0) that scales more in one direction.

    Non-uniform scale works, but some collisions are not perfectly calculated then:

    Note that ScaleOrientation matters only in case of non-uniform scale.

  2. All scale components should > 0 if you want 3D lighting to work corrrectly. That is, avoid negative scale, that changes the normals and orientation of faces (counter-clockwise becomes clockwise, if all scale components are -1), or standard lighting may not work Ok.

    For unlit stuff, or custom lighting, negative scale may be Ok. For many 2D games that use no lighting/custom lighting, negative scale is Ok.

    If you really need to use negative scale and lighting, enable TCastleRenderOptions.RobustNegativeScale.

  3. At least, keep all scale components non-zero. Otherwise the scaling operation is not invertible, and generally collisions will not work correctly.

    If you really need to set zero scale, the object should not be collidable then. Set Collides = False and don't add TCastleCollider as a behavior.

Set it like this:

Scene.Scale := Vector3(5, 5, 5);
Scene.Scale := Scene.Scale * 1.5;

Source: transform/castletransform_transform.inc (line 1752).

Public property ScaleOrientation: TVector4 read FScaleOrientation write SetScaleOrientation;

This item is declared in ancestor TCastleTransform.

Orientation in which 3D Scale is performed.

Source: transform/castletransform_transform.inc (line 1755).

Public property RigidBody: TCastleRigidBody read FCachedRigidBody;

This item is declared in ancestor TCastleTransform.

Current TCastleRigidBody behavior that determines do we participate in the physics simulation.

This property is always exactly equivalent to using FindBehavior(TCastleRigidBody) as TCastleRigidBody. It is just a more convenient (and marginally faster) way to access this common behavior.

See physics manual for an overview of using physics. You need to add both TCastleRigidBody and TCastleCollider to make physics work. Then this object is collidable with other rigid bodies, it can move and rotate because of gravity or because of collisions with other objects (if TCastleRigidBody.Dynamic is True).

It is not possible to set this property. Instead use AddBehavior to add an instance of TCastleRigidBody to the behaviors list. If there was a previous TCastleRigidBody instance, you can decide what to do with it, e.g. you can remove it using RemoveBehavior.

Note that an object can only be present once in the World to be a rigid body. Breaking this rule will cause the EMultipleReferencesInWorld exception at an undefined time.

Source: transform/castletransform_transform.inc (line 1786).

Public property Collider: TCastleCollider read FCachedCollider;

This item is declared in ancestor TCastleTransform.

Current TCastleCollider behavior that determines what is the shape of this object when it participates in the physics simulation.

This property is always exactly equivalent to using FindBehavior(TCastleCollider) as TCastleCollider. It is just a more convenient (and marginally faster) way to access this common behavior.

See physics manual for an overview of using physics. You need to add both TCastleRigidBody and TCastleCollider to make physics work. Then this object is collidable with other rigid bodies, it can move and rotate because of gravity or because of collisions with other objects (if TCastleRigidBody.Dynamic is True).

It is not possible to set this property. Instead use AddBehavior to add an instance of TCastleCollider to the behaviors list. If there was a previous TCastleCollider instance, you can decide what to do with it, e.g. you can remove it using RemoveBehavior.

Note that an object can only be present once in the World to be a rigid body. Breaking this rule will cause the EMultipleReferencesInWorld exception at an undefined time.

Source: transform/castletransform_transform.inc (line 1813).

Public property Position: TVector3 read FTranslation write SetTranslation; deprecated 'use Translation';

This item is declared in ancestor TCastleTransform.

Warning: this symbol is deprecated: use Translation

Deprecated name for Translation.

Source: transform/castletransform_transform.inc (line 1816).

Public property Direction: TVector3 read GetDirection write SetDirection;

This item is declared in ancestor TCastleTransform.

Direction that this transformation (like creature, space ship, missile, a camera...) is facing. The property Up contains an associated up vector. Together, the Direction and Up properties provide an alternative way to get and set the Rotation of the transformation.

Thinking in terms of "direction" and "up" is more natural than thinking about Rotation for various game objects. For example, you can move a missile forward by this simple operation:

MyMissile.Translation := MyMissile.Translation +
  MyMissile.Direction * SecondsPassed * MissileMoveSpeed;

The Orientation determines what is the direction and up you get when the Rotation is zero. For example Orientation = otUpYDirectionZ (default now) means that:

  1. When Rotation is zero, then Up will be +Y axis (0,1,0) and Direction will be +Z axis (0,0,1).

  2. Setting the Direction and Up to other values will be properly converted.

  3. So when Orientation = otUpYDirectionZ, and you set

    MyMissile.Direction := Vector3(0, 0, 1);
    MyMissile.Up := Vector3(0, 1, 0);

    then you effectively have set MyMissile.Rotation to zero (no rotation). That is, you could have as well done just this:

    MyMissile.Rotation := TVector4.Zero;

    Note that you can also set direction and up more efficiently by one SetView call. So this is one more way to do it, also equivalent:

    MyMissile.SetView(Vector3(0, 0, 1), Vector3(0, 1, 0));

Note that changing Orientation property does not perform any transformation of the model, it will look the same as it was, no matter what Orientation you set. Only changing the Direction or Up actually change the Rotation, which in turn actually change how the model looks. This also implies that Orientation value completely doesn't matter if you never get or set Direction or Up. All engine rendering and processing just looks at Rotation.

See Orientation for documentation of its default value.

The Direction and Up vectors should always be normalized (have length 1). But when setting them by these properties, we will normalize them automatically, so you don't need to worry about that.

The direction and up vectors must always be orthogonal. When setting Direction, Up will always be automatically adjusted to be orthogonal to Direction. And vice versa — when setting Up, Direction will be adjusted.

Source: transform/castletransform_transform.inc (line 1886).

Public property Up: TVector3 read GetUp write SetUp;

This item is declared in ancestor TCastleTransform.

This item has no description.

Source: transform/castletransform_transform.inc (line 1887).

Public property WorldView: TViewVectors read GetWorldViewRec write SetWorldViewRec;

This item is declared in ancestor TCastleTransform.

Position, direction and up in world coordinates.

Returned TViewVectors.Direction and TViewVectors.Up are always orthogonal. Returned TViewVectors.Dir and TViewVectors.Up are always normalized.

When setting, TViewVectors.Direction and TViewVectors.Up do not need to be normalized. We will internally normalize them if necessary.

When setting, we will also automatically fix TViewVectors.Direction and TViewVectors.Up to be orthogonal, if necessary: we will adjust the up vector (preserving the given direction value).

Source: transform/castletransform_transform.inc (line 1915).

Public property Orientation: TOrientationType read FOrientation write FOrientation;

This item is declared in ancestor TCastleTransform.

How the direction and up vectors determine transformation. See TOrientationType for values documentation.

The default value of this is:

This value determines how you should model your 3D models, like the creatures, the items, and the player weapons.

Source: transform/castletransform_transform.inc (line 1998).

Public property List: TCastleTransformList read FList;

This item is declared in ancestor TCastleTransform.

Transformation objects inside. Freeing these items automatically removes them from this list.

Source: transform/castletransform_transform.inc (line 2002).

Public property Behaviors [const Index: Integer]: TCastleBehavior read GetBehaviors;

This item is declared in ancestor TCastleTransform.

Enumerate current behaviors.

See also
AddBehavior
Add a TCastleBehavior to this TCastleTransform.
RemoveBehavior
Remove TCastleBehavior from this TCastleTransform.

Source: transform/castletransform_transform.inc (line 2062).

Public property ExistsInRoot: Boolean read FExistsInRoot;

This item is declared in ancestor TCastleTransform.

Does this object, and all it's parents up to the root, exist. This has undefined value in case you place this TCastleTransform instance (or any parent) many times within the viewport root, and some parents exist while some not.

This property doesn't check whether this TCastleTransform is actually part of some World. So it will be True if this item doesn't have any parent. It only checks that "all parents, going up the tree, have Exists true".

Source: transform/castletransform_transform.inc (line 2088).

Published property Exists: Boolean read FExists write SetExists default true;

This item is declared in ancestor TCastleTransform.

Is this object (and all children) visible and colliding. Setting this to False makes this object non-existing, just as if removing the object from parent would do.

Non-existing object implies also that all children are non-existing. Behaviors on non-existing objects should also stop working, e.g. physics engine should ignore bodies / colliders attached to non-existing objects, and (TODO) TCastleSoundsource should not play when attached to non-existing object.

Source: transform/castletransform_transform.inc (line 2169).

Published property Collides: boolean read FCollides write FCollides default true;

This item is declared in ancestor TCastleTransform.

Should this collide when simple physics is used. This setting is honored e.g. by current collisions done by FPS walk/fly navigation using TCastleWalkNavigation. This setting is ignored by the physics engine (for physics, control if something collides just by adding / removing a TCastleCollider component).

You can turn this off, useful to make e.g. "fake" walls (to some secret places on level).

This describes collision resolution with almost everything — camera, player (in third-person perspective, camera may differ from player), other creatures. That is because everything resolves collisions through our methods MoveCollision and HeightCollision (high-level) or SegmentCollision, SphereCollision, SphereCollision2D, PointCollision2D, BoxCollision (low-level).

(Note that RayCollision is excluded from this, it exceptionally ignores Collides value, as it's primarily used for picking. Same for SegmentCollision with LineOfSight=true.)

The only exception are the collisions with TCastleMoving instances (movable world parts like elevators and doors) that have their own detection routines and look at CollidesWithMoving property of other objects. That is, the TCastleMoving instance itself must still have Collides = True, but it interacts with other objects if and only if they have CollidesWithMoving = True (ignoring their Collides value). This allows items to be moved by elevators, but still player and creatures can pass through them.

Note that if not Exists then this doesn't matter (non-existing objects never participate in collision detection).

Source: transform/castletransform_transform.inc (line 2205).

Published property Pickable: boolean read FPickable write FPickable default true;

This item is declared in ancestor TCastleTransform.

Is item pickable by RayCollision method. Note that if not Exists then this doesn't matter (non-existing objects are never pickable).

This affects ray collisions only for some methods that are part of old simple physics. This setting is ignored by the physics engine.

This is independent from Collides, as RayCollision does not look at Collides, it only looks at Pickable.

Source: transform/castletransform_transform.inc (line 2218).

Published property Visible: boolean read FVisible write FVisible default true;

This item is declared in ancestor TCastleTransform.

Is this object (and all children) visible. Note that if not Exists then this doesn't matter (non-existing objects are never visible).

Just like most TCastleTransform properties, this affects both this TCastleTransform instance (which may be a TCastleScene instance) and all children, recursively. In other words, setting this to False hides this object and all children.

This is independent from Collides or Pickable.

Source: transform/castletransform_transform.inc (line 2231).

Published property CollisionSphereRadius: Single read FCollisionSphereRadius write FCollisionSphereRadius;

This item is declared in ancestor TCastleTransform.

When non-zero, we can approximate collisions with this object using a sphere in certain situations (MoveAllowed, Gravity). This usually makes dynamic objects, like player and creatures, collide better.

Just like Middle, this is expressed in the parent coordinate system.

Source: transform/castletransform_transform.inc (line 2239).

Published property CastShadows: boolean read FCastShadows write FCastShadows default true;

This item is declared in ancestor TCastleTransform.

Does this object (and children) cast shadows.

Just like most TCastleTransform properties, this affects both this TCastleTransform instance (which may be a TCastleScene instance) and all children, recursively. In other words, setting this to False makes this object and all children not cast shadows.

TODO: Right now this only affects casting shadows by shadow volumes. It will be extended to account for shadow maps.

Source: transform/castletransform_transform.inc (line 2250).

Published property RenderLayer: TRenderLayer read FRenderLayer write FRenderLayer default rlParent;

This item is declared in ancestor TCastleTransform.

Objects on front render layer are rendered in front of objects on back render layer, regardless of their actual position (depth) relative to camera.

rlParent means that object follows the parent layer, which is by default back.

The typical use-case is to force some object to be in front, by setting rlFront.

Source: transform/castletransform_transform.inc (line 2259).

Published property CenterPersistent: TCastleVector3Persistent read FCenterPersistent ;

This item is declared in ancestor TCastleTransform.

Center that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Center directly.

See also
Center
Center point around which the Rotation and Scale is performed.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 37).

Published property RotationPersistent: TCastleVector4RotationPersistent read FRotationPersistent ;

This item is declared in ancestor TCastleTransform.

Rotation that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Rotation directly.

See also
Rotation
Rotation in 3D, around a specified axis.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 105).

Published property ScalePersistent: TCastleVector3Persistent read FScalePersistent ;

This item is declared in ancestor TCastleTransform.

Scale that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Scale directly.

See also
Scale
Scale in 3D.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 173).

Published property ScaleOrientationPersistent: TCastleVector4Persistent read FScaleOrientationPersistent ;

This item is declared in ancestor TCastleTransform.

ScaleOrientation that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write ScaleOrientation directly.

See also
ScaleOrientation
Orientation in which 3D Scale is performed.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 241).

Published property TranslationPersistent: TCastleVector3Persistent read FTranslationPersistent ;

This item is declared in ancestor TCastleTransform.

Translation that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Translation directly.

See also
Translation
Translation (move) the children.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 309).

Published property DirectionPersistent: TCastleVector3Persistent read FDirectionPersistent stored false;

This item is declared in ancestor TCastleTransform.

Direction that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Direction directly.

See also
Direction
Direction that this transformation (like creature, space ship, missile, a camera...) is facing.

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 377).

Published property UpPersistent: TCastleVector3Persistent read FUpPersistent stored false;

This item is declared in ancestor TCastleTransform.

Up that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Up directly.

See also
Up

Source: transform/auto_generated_persistent_vectors/tcastletransform_persistent_vectors.inc (line 445).

Protected property VisibilitySensors: TVisibilitySensors read FVisibilitySensors;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 878).

Public property Shapes: TShapeTree read FShapes;

This item is declared in ancestor TCastleSceneCore.

Tree of shapes in the scene, acting as a simplified version of the X3D node graph. Contents of this tree are read-only from outside.

Source: scene/castlescenecore.pas (line 1075).

Public property OnGeometryChanged: TSceneGeometryChanged read FOnGeometryChanged write FOnGeometryChanged;

This item is declared in ancestor TCastleSceneCore.

Notification when geometry changed. "Geometry changed" means that the positions of triangles changed. This is not send when merely things like material changed.

It is not guaranteed that octrees are already recalculated when this is called. (They may be recalculated only on-demand, that is when you actually access them.) However, it is guaranteed that shape's transformation (like TShape.State.Transform) are already updated.

Source: scene/castlescenecore.pas (line 1228).

Public property OnViewpointsChanged: TNotifyEvent read FOnViewpointsChanged write FOnViewpointsChanged;

This item is declared in ancestor TCastleSceneCore.

Notification when the list of viewpoints in the scene possibly changed.

Note that this doesn't necessarily mean that the current, bound viewpoint changed (although it could). If you only want to get notified when currently bound viewpoint changes, then what you seek is rather ViewpointStack.OnBoundChanged.

Source: scene/castlescenecore.pas (line 1239).

Public property OnBoundViewpointVectorsChanged: TNotifyEvent read FOnBoundViewpointVectorsChanged write FOnBoundViewpointVectorsChanged;

This item is declared in ancestor TCastleSceneCore.

Notification when the currently bound viewpoint's vectors (position/orientation and such) changed.

More precisely, this is called whenever values generated by ViewpointStack.Top.GetView changed.

It cannot be called when ViewpointStack.Top = Nil. Note that this also doesn't notify you about changes to currently bound viewpoint, for this you rather want to use ViewpointStack.OnBoundChanged. This is called only when currently bound viewpoint stays the same, only it's vectors change.

Source: scene/castlescenecore.pas (line 1254).

Public property OnBoundNavigationInfoFieldsChanged: TNotifyEvent read FOnBoundNavigationInfoFieldsChanged write FOnBoundNavigationInfoFieldsChanged;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1271).

Public property RootNode: TX3DRootNode read FRootNode write SetRootNode;

This item is declared in ancestor TCastleSceneCore.

Actual VRML/X3D graph defining this scene.

It is allowed to change contents of RootNode. Just make sure the scene is notified about these changes. The simplest option is to use simple properties of nodes (not the ones starting with Fd... prefix), when possible. Then everything is notified automatically. If you must use fields through the FdXxx properties, then assign them using TX3DField.Send, or (if you need to assign field values directly, like TSFVec3f.Value := ...) call TX3DField.Changed.

It is also allowed to change the value of RootNode and even to set RootNode to Nil. Changing RootNode allows you to load and unload whole new VRML/X3D graph (for example from some 3D file) whenever you want, and keep the same TCastleSceneCore instance (with the same rendering settings and such).

Source: scene/castlescenecore.pas (line 1343).

Public property OwnsRootNode: boolean read FOwnsRootNode write FOwnsRootNode default true; deprecated 'set OwnsRootNode only at loading, do not depend on this property';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: set OwnsRootNode only at loading, do not depend on this property

If True, RootNode will be freed by destructor of this class.

Source: scene/castlescenecore.pas (line 1346).

Public property PointingDeviceOverItem: PTriangle read FPointingDeviceOverItem write FPointingDeviceOverItem;

This item is declared in ancestor TCastleSceneCore.

Current item over which the pointing device is. Nil if over none. For example, you can investigate it's pointing device sensors (in PointingDeviceOverItemˆ.State.PointingDeviceSensors), although there's a shortcut for just this in PointingDeviceSensors. You can change this by PointingDeviceMove and PointingDeviceClear.

Source: scene/castlescenecore.pas (line 1477).

Public property PointingDeviceOverPoint: TVector3 read FPointingDeviceOverPoint write FPointingDeviceOverPoint;

This item is declared in ancestor TCastleSceneCore.

Current 3D point under the pointing device. Only meaningful when PointingDeviceOverItem <> nil, otherwise undefined.

Source: scene/castlescenecore.pas (line 1483).

Public property PointingDeviceActiveSensors: TX3DNodeList read FPointingDeviceActiveSensors;

This item is declared in ancestor TCastleSceneCore.

Currently active pointing-device sensors. Only TAbstractPointingDeviceSensorNode instances. Always empty when PointingDeviceActive = False. Read-only from outside of this class.

Note that sensor specified here doesn't have to be one of the sensors of PointingDeviceOverItem. When some sensor is activated, it grabs further events until it's deactivated (e.g. when you set PointingDeviceActive := false, which means that user released mouse button). This means that when user moves the mouse while given sensors are active, he can move mouse over other items, even the ones where the active sensors aren't listed — but the sensors remain active.

Source: scene/castlescenecore.pas (line 1504).

Public property PointingDeviceActive: boolean read FPointingDeviceActive default false;

This item is declared in ancestor TCastleSceneCore.

Is pointing device currently active (for example, mouse button is pressed down).

Source: scene/castlescenecore.pas (line 1524).

Public property OnPointingDeviceSensorsChange: TNotifyEvent read FOnPointingDeviceSensorsChange write FOnPointingDeviceSensorsChange;

This item is declared in ancestor TCastleSceneCore.

Event called PointingDeviceSensors or PointingDeviceActiveSensors lists (possibly) changed.

Source: scene/castlescenecore.pas (line 1529).

Public property TimeAtLoad: TFloatTime read FTimeAtLoad;

This item is declared in ancestor TCastleSceneCore.

Initial world time, set by the last ResetTimeAtLoad call.

Source: scene/castlescenecore.pas (line 1628).

Public property BackgroundStack: TBackgroundStack read FBackgroundStack;

This item is declared in ancestor TCastleSceneCore.

Stack of background nodes. The node at the top is the current background, which is displayed if this is the TCastleRootTransform.MainScene. All nodes on this stack must descend from TAbstractBackgroundNode class.

We don't recommend using this to influence the resulting background, as designating the scene as "main" using TCastleRootTransform.MainScene makes using various features "entangled" through this scene (so it's not flexible), and designing background using X3D nodes is not comfortable.

We recommend instead to leave TCastleRootTransform.MainScene as Nil, and use TCastleViewport.Background to modify the skybox.

Source: scene/castlescenecore.pas (line 1643).

Public property FogStack: TFogStack read FFogStack;

This item is declared in ancestor TCastleSceneCore.

Stack of fog nodes. The node at the top is the current fog, which is displayed if this is the TCastleRootTransform.MainScene. All nodes on this stack must descend from TFogNode class.

We don't recommend using this to influence the resulting fog, as designating the scene as "main" using TCastleRootTransform.MainScene makes using various features "entangled" through this scene (so it's not flexible), and designing background using X3D nodes is not comfortable.

We recommend instead to leave TCastleRootTransform.MainScene as Nil, and use TCastleViewport.Fog to modify the fog.

Source: scene/castlescenecore.pas (line 1658).

Public property NavigationInfoStack: TNavigationInfoStack read FNavigationInfoStack;

This item is declared in ancestor TCastleSceneCore.

Stack of NavigatinInfo nodes. The node at the top is the current NavigatinInfo. All nodes on this stack must descend from TNavigationInfoNode class.

Source: scene/castlescenecore.pas (line 1662).

Public property ViewpointStack: TViewpointStack read FViewpointStack;

This item is declared in ancestor TCastleSceneCore.

Stack of viewpoint nodes. The node at the top is the current Viewpoint. All nodes on this stack must descend from TAbstractViewpointNode. Note that this includes also VRML 1.0/Inventor nodes.

Source: scene/castlescenecore.pas (line 1667).

Public property CompiledScriptHandlers: TCompiledScriptHandlerInfoList read FCompiledScriptHandlers;

This item is declared in ancestor TCastleSceneCore.

List of handlers for VRML/X3D Script node with "compiled:" protocol. This is read-only, change this only by RegisterCompiledScript.

Source: scene/castlescenecore.pas (line 1676).

Public property HeadlightOn: boolean read FHeadlightOn write SetHeadlightOn;

This item is declared in ancestor TCastleSceneCore.

Should we use headlight for this scene. Controls if containing TCastleViewport will use a headlight, if this is the main scene.

When you load a new model, this is always updated based on this model's NavigationInfo.headlight. (If no NavigationInfo node, then default is to use the headlight.) When you bind a new NavigationInfo node, this is also updated to follow NavigationInfo.headlight.

You can change the value of this property. If we have a NavigationInfo node, then NavigationInfo.headlight field will be always updated to correspond to this value. (It will be even updated using events mechanism if ProcessEvents, so scripts inside the VRML/X3D "know" when you turn on/off the headlight and may react to it, e.g. spawn a zombie monster when you turn on the flashlight.)

Source: scene/castlescenecore.pas (line 1801).

Public property OnHeadlightOnChanged: TNotifyEvent read FOnHeadlightOnChanged write FOnHeadlightOnChanged;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 1804).

Public property InternalGlobalLights: TLightInstancesList read FGlobalLights;

This item is declared in ancestor TCastleSceneCore.

Global lights of this scene. Read-only. Useful to shine these lights on other scenes, if TCastleScene.CastGlobalLights.

Source: scene/castlescenecore.pas (line 1817).

Public property AnimationsList: TStrings read FAnimationsList;

This item is declared in ancestor TCastleSceneCore.

List the names of available animations in current scene. Animations are detected looking for TimeSensor nodes. See https://castle-engine.io/x3d_implementation_interpolation.php for an overview how nodes are used to create animations.

Note that if you set AnimationPrefix property, we additionally filter TimeSensor nodes to show only the names starting with given prefix. In this case, not all TTimeSensorNode are reflected in this list.

You can get the corresponding TTimeSensorNode by AnimationTimeSensor. Note that the same TTimeSensorNode may occur multiple times on this list, in case X3D IMPORT mechanism was used to rename the imported animation.

The resulting TStringList instance is owned by this object, do not free it.

Note that the list of animations may change if you rebuild the underlying X3D nodes graph, for example if you start to delete / add some TimeSensor nodes.

Source: scene/castlescenecore.pas (line 1915).

Public property AnimationPrefix: String read FAnimationPrefix write FAnimationPrefix; deprecated 'this property did not prove to be of much use; report if you need it, otherwise it may be removed one day';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: this property did not prove to be of much use; report if you need it, otherwise it may be removed one day

The prefix of an X3D TimeSensor node name to treat it as a "named animation". Named animation are used by methods AnimationsList, PlayAnimation, and AnimationDuration, HasAnimation. By default this is empty, which means we consider all TimeSensor nodes a "named animation".

You can set this to something like 'Anim_' or 'Animation_' or whatever your 3D export software produces. Only the TimeSensor nodes with names starting with this prefix will be available on AnimationsList, and this prefix will be stripped from the names you use with methods like PlayAnimation.

Source: scene/castlescenecore.pas (line 2074).

Public property CurrentAnimation: TTimeSensorNode read FCurrentAnimation;

This item is declared in ancestor TCastleSceneCore.

Currently played animation by PlayAnimation, or Nil.

Note that, in a general case, you can have multiple active animations (multiple TimeSensor X3D nodes may be active) at the same time. Calling TTimeSensorNode.Start directly on multiple nodes is one way to make it happen. This property simply describes the animation controlled by the last PlayAnimation method.

Note that the animation may be started by PlayAnimation with a 1-frame delay, but this property hides it from you, it is changed immediately by the PlayAnimation call.

Source: scene/castlescenecore.pas (line 2091).

Public property FileName: String read FUrl write SetUrl; deprecated;

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated.

Deprecated name for Url.

Source: scene/castlescenecore.pas (line 2146).

Public property InternalShapesHash: TShapesHash read FShapesHash;

This item is declared in ancestor TCastleSceneCore.

This item has no description.

Source: scene/castlescenecore.pas (line 2150).

Published property DefaultAnimationTransition: Single read FDefaultAnimationTransition write FDefaultAnimationTransition default 0.0;

This item is declared in ancestor TCastleSceneCore.

When using PlayAnimation without TPlayAnimationParameters, this value is used as the duration (in seconds) of animation cross-fade (blending of animations). Zero (default value) disables the smooth transition, animations will change without any transition by default.

This default transition is only used if some previous animation was playing. Otherwise, it would be applied even when starting the initial animation.

Source: scene/castlescenecore.pas (line 2170).

Published property TimePlaying: boolean read FTimePlaying write FTimePlaying default true;

This item is declared in ancestor TCastleSceneCore.

When TimePlaying is True, the time of our 3D world will keep playing. More precisely, our Update will take care of increasing Time. Our Update is usually automatically called (if you added this scene to TCastleWindow.Controls or TCastleControl.Controls) so you don't have to do anything to make this work.

Source: scene/castlescenecore.pas (line 2178).

Published property TimePlayingSpeed: Single read FTimePlayingSpeed write FTimePlayingSpeed default 1.0;

This item is declared in ancestor TCastleSceneCore.

Controls the time speed (if TimePlaying is True): 1.0 means that 1 second of real time equals to 1 unit of world time.

Source: scene/castlescenecore.pas (line 2182).

Published property PreciseCollisions: Boolean read FPreciseCollisions write SetPreciseCollisions default false;

This item is declared in ancestor TCastleSceneCore.

Resolve collisions precisely with the scene triangles.

When this is False we will only consider the bounding box of this scene for collisions. We look at bounding box of model loaded in Url, not at children (TCastleTransform) bounding boxes.

More details: Setting this creates two spatial structures (octrees):

  1. To detect collisions in dynamic scenes.

    This allows to resolve collisions with the (collidable) triangles of the model. By default, every X3D Shape is collidable using it's exact mesh. You can use the X3D TCollisionNode to turn collisions off for some shapes, or replace some shapes with simpler objects for the collision-detection purposes.

    You can always toggle Collides to quickly make the scene not collidable. In summary:

    • Collides = False: the scene does not collide.

    • Collides = True and PreciseCollisions = True: the scene collides as it's bounding box (LocalBoundingBoxNoChildren to be precise, so the box of Url model is taken into account, but not children). This is the default situation after constructing TCastleScene.

    • Collides = True and PreciseCollisions = False: The scene collides as a set of triangles. The triangles are derived from information in X3D Shape and Collision nodes.

  2. To speedup frustum culling.

    This adds an additional optimization during rendering. It allows to use frustum culling with an octree. Whether the frustum culling is actually used depends on TCastleScene.ShapeFrustumCulling value (by default: yes).

    Without this flag, we can still use frustum culling, but it's less effective as it considers each shape separately. Whether the frustum culling is actually used also depends on TCastleScene.ShapeFrustumCulling value.

    Using frustum culling (preferably with PreciseCollisions = True) is highly adviced if your camera usually only sees only a part of the scene. For example, it a noticeable optimization if you have a camera walking/flying inside a typical game level/location.

Source: scene/castlescenecore.pas (line 2243).

Published property ProcessEvents: boolean read FProcessEvents write SetProcessEvents default false;

This item is declared in ancestor TCastleSceneCore.

Should the event mechanism (a basic of animations and interactions) work.

If True, then events will be send and received through X3D routes, time dependent nodes (TTimeDependentFunctionality, like TTimeSensorNode) will be activated and updated from Time time property, Press, Release and other methods will activate key/mouse sensor nodes, scripts will be initialized and work, etc.

In other words, this makes the scene fully animated and interacting with the user.

If False, this all doesn't work, which makes the scene static.

Source: scene/castlescenecore.pas (line 2257).

Published property Url: String read FUrl write SetUrl;

This item is declared in ancestor TCastleSceneCore.

Currently loaded scene URL. Change this property to load a scene from the given URL. We support many 3D and 2D scene formats, like X3D and glTF, see https://castle-engine.io/creating_data_model_formats.php .

Setting this property works just like using the Load method with a new URL. In fact, using directly the Load method will also change this URL property.

The only difference between Scene.Url := 'blah.x3d' and Scene.Load('blah.x3d') is that setting the URL will not reload the scene if you set it to the same value. That is, Scene.Url := Scene.Url; will not reload the scene (you have to use explicit Load for this.).

Pass Url = '' to load an empty scene, this sets RootNode to Nil.

Source: scene/castlescenecore.pas (line 2276).

Published property ShadowMaps: boolean read FShadowMaps write SetShadowMaps default true;

This item is declared in ancestor TCastleSceneCore.

At loading, process the scene to support shadow maps. This happens at the Load method call, and it makes "receiveShadows" field automatically handled.

Note that this is not the only way to make shadow maps. VRML/X3D author can always make shadow maps by using lower-level nodes, see [https://castle-engine.io/x3d_extensions.php#section_ext_shadow_maps]. When using these lower-level nodes, this property does not matter This property (and related ones like ShadowMapsDefaultSize) is relevant only for handling shadows by the "receiveShadows" field.

Source: scene/castlescenecore.pas (line 2289).

Published property ShadowMapsDefaultSize: Cardinal read FShadowMapsDefaultSize write SetShadowMapsDefaultSize default DefaultShadowMapsDefaultSize;

This item is declared in ancestor TCastleSceneCore.

Default shadow map texture size.

Affects how shadow maps are handled for the "receiveShadows" field. This is taken into account at the scene Load time, and only if ShadowMaps is True.

VRML/X3D author can always override this by placing a GeneratedShadowMap node inside light's defaultShadowMap field. In this case, GeneratedShadowMap.size determines shadow map size.

Source: scene/castlescenecore.pas (line 2300).

Published property InitialViewpointIndex: Cardinal read FInitialViewpointIndex write FInitialViewpointIndex default 0;

This item is declared in ancestor TCastleSceneCore.

When loading new model, use this viewpoint index to initialize camera. VRML/X3D specification says to use the first (index = 0) viewpoint, you can change this property to bind 2nd, 3rd and so on viewpoints.

This is applied only at loading (actually, at ChangedAll). If you later want to bind another viewpoint, just send set_bind := true to it.

Source: scene/castlescenecore.pas (line 2311).

Published property InitialViewpointName: String read FInitialViewpointName write FInitialViewpointName;

This item is declared in ancestor TCastleSceneCore.

When loading new model and looking for initial viewpoint, consider only viewpoints with this node name. Relevant only if non-empty.

This may cooperate with InitialViewpointIndex: InitialViewpointIndex specifies the index of viewpoint node that satisfies also InitialViewpointName condition. For example:

  • InitialViewpointIndex = 0 and InitialViewpointName = '' means to use the first viewpoint, ignoring nodes' names. This is the default behavior, also following VRML/X3D specification.

  • InitialViewpointIndex = 1 and InitialViewpointName = '' means to use the 2nd viewpoint. Node name doesn't matter.

  • InitialViewpointIndex = 1 and InitialViewpointName = 'blah' means to use the first viewpoint named 'blah'. That is, we are only counting nodes named 'blah' for this.

Source: scene/castlescenecore.pas (line 2332).

Published property AnimateOnlyWhenVisible: boolean read FAnimateOnlyWhenVisible write FAnimateOnlyWhenVisible default false;

This item is declared in ancestor TCastleSceneCore.

When True, we animate (more precisely: process time pass in Update) only when the model is visible. This is a powerful optimization, but be careful if you depend on your animations for something else than just visual effect.

See examples/animations/optimize_animations_test for a demo of this.

Source: scene/castlescenecore.pas (line 2342).

Published property AnimateSkipTicks: Cardinal read FAnimateSkipTicks write SetAnimateSkipTicks default 0;

This item is declared in ancestor TCastleSceneCore.

Non-zero values optimize the animation processing, by not updating the animation every frame. After updating the animation in one Update call, the next AnimateSkipTicks number of Update calls will go very quickly, as they will not actually change the scene at all.

This is an effective optimization if the scene is usually not large on the screen.

  • The animation is less smooth. For example, if AnimateSkipTicks = 1, then every other Update call does not change the scene. For example, if you have 60 FPS, and Update is called 60 times per second, then we will actually change the scene only 30 times per second.

    The "skip" within every scene has a little random shift, to avoid synchronizing this skip across many created scenes. This makes this a little harder to notice.

  • In exchange, the speedup is substantial. For example, if AnimateSkipTicks = 1, then the animation on CPU effectively costs 2x less. In general, AnimateSkipTicks = N means that the cost drops to 1 / (1 + N).

See examples/animations/optimize_animations_test for a demo of this.

Source: scene/castlescenecore.pas (line 2372).

Published property AutoAnimation: String read FAutoAnimation write SetAutoAnimation;

This item is declared in ancestor TCastleSceneCore.

If AutoAnimation is set, this animation will be automatically played. It is useful to determine the initial animation, played once the model is loaded (each time URL changes). You can also change AutoAnimation at any other moment at runtime (set it to something non-empty to change to a new animation; set it to '' to stop any animation).

Note: Using AutoAnimation will under the hood call methods like PlayAnimation, StopAnimation and update CurrentAnimation. The reverse is not true: calling PlayAnimation doesn't change AutoAnimation. So you can think of AutoAnimation as "an initial animation, activated each time we load the model, even if later we can change it to something else using PlayAnimation".

Source: scene/castlescenecore.pas (line 2386).

Published property AutoAnimationLoop: Boolean read FAutoAnimationLoop write SetAutoAnimationLoop default true; deprecated 'in future engine versions, AutoAnimationLoop may behave as always = true, and AutoAnimation will be renamed to just Animation and changing it will always cause a looping animation. Use PlayAnimation(''my_anim'',false) from code to play animation without looping.';

This item is declared in ancestor TCastleSceneCore.

Warning: this symbol is deprecated: in future engine versions, AutoAnimationLoop may behave as always = true, and AutoAnimation will be renamed to just Animation and changing it will always cause a looping animation. Use PlayAnimation('my_anim',false) from code to play animation without looping.

Does the animation indicated by AutoAnimation loops.

Source: scene/castlescenecore.pas (line 2390).

Published property ExposeTransforms: TStrings read FExposeTransforms write SetExposeTransforms;

This item is declared in ancestor TCastleSceneCore.

Transformation nodes inside the model that are synchronized with automatically-created children TCastleTransform.

This allows to expose transformation nodes from glTF, X3D and other model formats as TCastleTransform. These transformation nodes include animated bones from skeletons (armatures). Such "exposed transformation" results in a creation of TCastleTransform child, with the same name and synchronized transformation (translation, rotation, scale).

This allows to expose e.g. "hand that may hold a weapon", or "slot of a vehicle where to attach a camera", as TCastleTransform. And this allows, in turn, to attach various things to (possibly animated) transformations, e.g. attach model of a weapon to a hand, or attach TCastleCamera to some bone. The attached things will be automatically animated when the scene skeleton animates.

Setting this property merely copies the contents using TStrings.Assign, as is usual for published TStrings properties. In CGE editor, there's a nice GUI editor to pick the transfomation nodes, click on "..." at this property.

Note: the owner of auto-created children is equal to this scene's Owner. This is most natural when you edit this in CGE editor, or load using TransformLoad.

See the engine example in: examples/animations/expose_transformations_to_animate_children/ .

See also
ExposeTransformsPrefix
Name prefix for all children created by ExposeTransforms.

Source: scene/castlescenecore.pas (line 2421).

Published property ExposeTransformsPrefix: String read FExposeTransformsPrefix write SetExposeTransformsPrefix;

This item is declared in ancestor TCastleSceneCore.

Name prefix for all children created by ExposeTransforms. Useful to keep names unique in the scene.

Source: scene/castlescenecore.pas (line 2425).

Published property Cache: Boolean read FCache write FCache default false;

This item is declared in ancestor TCastleSceneCore.

Use cache to load given scene. This makes sense when you have multiple TCastleScene instances using the same URL, loading them will be much faster if they share the cache, so set Cache to True for all of them.

If you have only one scene using given URL, using cache is not necessary and in fact it will result in a bit of wasted memory. So better to keep Cache at False then.

Source: scene/castlescenecore.pas (line 2435).

Published property ShapeFrustumCulling: Boolean read FShapeFrustumCulling write SetShapeFrustumCulling default true;

Improve performance of rendering by checking for each shape whether it is inside frustum (camera pyramid of view) before rendering.

This is almost always a good idea. Exception may be when, in the most common scene position, all the shapes are inside the frustum, or all the shapes are outside the frustum. In this case this check is wasting time, and it matters if you have a lot of shapes. In such case, SceneFrustumCulling will be enough.

Source: scene/castlescene.pas (line 562).

Published property SceneFrustumCulling: Boolean read FSceneFrustumCulling write FSceneFrustumCulling default true;

Improve performance of rendering by checking for the whole scene whether it is inside frustum (camera pyramid of view) before rendering.

This is almost always a good idea. Exception may be when the scene is almost always within the frustum, and you have a lot of scenes. In such case, this check may be a waste of time.

Source: scene/castlescene.pas (line 572).

Published property ReceiveShadowVolumes: boolean read FReceiveShadowVolumes write FReceiveShadowVolumes default true;

Does this scene receive shadows by shadow volumes.

Source: scene/castlescene.pas (line 576).

Published property DistanceCulling: Single read FDistanceCulling write SetDistanceCulling default 0;

Cull shapes farther than this distance. Ignored if <= 0.

Source: scene/castlescene.pas (line 580).

Published property RenderOptions: TCastleRenderOptions read FRenderOptions;

Rendering options. You are free to change them at any time.

Source: scene/castlescene.pas (line 585).

Published property CastGlobalLights: Boolean read FCastGlobalLights write SetCastGlobalLights default false;

Lights defines by given scene shine on everything in the viewport, including all other TCastleScene.

Source: scene/castlescene.pas (line 588).

Published property TransformOptimization: TTransformOptimization read FTransformOptimization write FTransformOptimization default toAutomatic;

Optimization hint, determines which optimizations to use for this scene. Some optimizations are beneficial for scenes whose world transformation (translation, rotation, scale of this and all parents) never changes, or rarely changes, or changes only by a small amount. Some optimizations are the reverse: they make sense for scenes whose world transformation changes often and by large values.

See TTransformOptimization for possible values and more information.

The default value is toAutomatic, which means that we auto-detect the optimal approach.

For now, this only determines whether generated shaders...

  • ...include code to calculate all the light sources.

    This is more optimal for dynamic transformations, avoids the need to recreate shaders when transformation changes.

  • ...include code only for light sources whose radius includes the particular shape in the scene.

    This is more optimal for static transformations, makes shader code smaller, no point recalculating light sources whose influence is zero.

An unofficial way (we don't guarantee it will always be exposed this way) to test how often shaders are recreated is by setting LogRendererCache := true from unit CastleInternalRenderer. Observe the log output to see how often shaders are recreated. If you tweak this property, be sure to check whether this is improved.

Source: scene/castlescene.pas (line 623).


Generated by PasDoc 0.17.0.snapshot.