Class TSceneManagerWorld

Unit

Declaration

type TSceneManagerWorld = class(TCastleTransform)

Description

3D world. List of 3D objects, with some central properties.

Hierarchy

Overview

Fields

Public OnCursorChange: TNotifyEvent;
Public OnVisibleChange: TVisibleChangeEvent;

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function CollisionIgnoreItem(const Sender: TObject; const Triangle: PTriangle): boolean; virtual; abstract;
Public function GravityUp: TVector3; virtual; abstract;
Public function GravityCoordinate: Integer;
Public function Player: TCastleTransform; virtual; abstract;
Public function PrepareParams: TPrepareParams; virtual; abstract;
Public function Sectors: TSectorList; virtual; abstract;
Public function Water: TBox3D; virtual; abstract;
Public function WorldMoveAllowed( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; virtual; abstract;
Public function WorldMoveAllowed( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; virtual; abstract;
Public function WorldHeight(const APosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; virtual; abstract;
Public function WorldLineOfSight(const Pos1, Pos2: TVector3): boolean; virtual; abstract;
Public function WorldRay(const RayOrigin, RayDirection: TVector3): TRayCollision; virtual; abstract;
Public function WorldBoxCollision(const Box: TBox3D): boolean;
Public function WorldSphereCollision(const Pos: TVector3; const Radius: Single): boolean;
Public function WorldSphereCollision2D(const Pos: TVector2; const Radius: Single; const Details: TCollisionDetails = nil): boolean;
Public function WorldPointCollision2D(const Point: TVector2): boolean;
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
Public procedure CameraChanged(ACamera: TCamera); override;

Properties

Public property CameraPosition: TVector3 read FCameraPosition;
Public property CameraDirection: TVector3 read FCameraDirection;
Public property CameraUp: TVector3 read FCameraUp;
Public property CameraKnown: boolean read FCameraKnown;
Public property EnablePhysics: boolean read FEnablePhysics write FEnablePhysics default true;

Description

Fields

Public OnCursorChange: TNotifyEvent;
 
Public OnVisibleChange: TVisibleChangeEvent;
 

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public function CollisionIgnoreItem(const Sender: TObject; const Triangle: PTriangle): boolean; virtual; abstract;

See TCastleSceneManager.CollisionIgnoreItem.

Public function GravityUp: TVector3; virtual; abstract;

Up vector, according to gravity. Gravity force pulls in -GravityUp direction.

Public function GravityCoordinate: Integer;

The major axis of gravity vector: 0, 1 or 2. This is derived from GravityUp value. It can only truly express GravityUp vector values (1,0,0) or (0,1,0) or (0,0,1), although in practice this is enough for normal games (normal 3D scenes use up either +Y or +Z).

We try to avoid using it in the engine, and use full GravityUp vector wherever possible. Full GravityUp vector may allow for more fun with weird gravity in future games.

Public function Player: TCastleTransform; virtual; abstract;

Player, see TCastleSceneManager.Player.

Public function PrepareParams: TPrepareParams; virtual; abstract;

Parameters to prepare rendering for, see TCastleAbstractViewport.PrepareParams.

Public function Sectors: TSectorList; virtual; abstract;

Sectors in the world, for AI. See TCastleSceneManager.Sectors.

Public function Water: TBox3D; virtual; abstract;

Water volume. See TCastleSceneManager.Water.

Public function WorldMoveAllowed( const OldPos, ProposedNewPos: TVector3; out NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; virtual; abstract;

Collisions with world. They call corresponding methods without the World prefix, automatically taking into account some knowledge about this 3D world.

Calling these methods to check collisions makes sense if your collision query is not initiated by any existing TCastleTransform instance.

If your query originates from some existing TCastleTransform instance, you usually do not want to call these WorldXxx methods. Instead call TCastleTransform.MoveAllowed, TCastleTransform.Height methods. Underneath, they still call World.WorldMoveAllowed and World.WorldHeight, additionally making sure that the 3D object does not collide with itself.

Public function WorldMoveAllowed( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; virtual; abstract;
 
Public function WorldHeight(const APosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; virtual; abstract;
 
Public function WorldLineOfSight(const Pos1, Pos2: TVector3): boolean; virtual; abstract;
 
Public function WorldRay(const RayOrigin, RayDirection: TVector3): TRayCollision; virtual; abstract;
 
Public function WorldBoxCollision(const Box: TBox3D): boolean;
 
Public function WorldSphereCollision(const Pos: TVector3; const Radius: Single): boolean;
 
Public function WorldSphereCollision2D(const Pos: TVector2; const Radius: Single; const Details: TCollisionDetails = nil): boolean;
 
Public function WorldPointCollision2D(const Point: TVector2): boolean;
 
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
 
Public procedure CameraChanged(ACamera: TCamera); override;
 

Properties

Public property CameraPosition: TVector3 read FCameraPosition;

Camera position, direction and up, in the world coordinates.

Note that some features of TCastleScene (like LOD or Billboard or ProximitySensor) will need to transform this camera to scene local space. They use WorldTransform, and will raise ETransformParentUndefined when it is not possible (e.g. when the same scene instance is reused under many different locations).

So, to be on the safe side, do not turn on TCastleSceneCore.ProcessEvents, or do not share the scene in multiple places in the scene manager. Or at least don't use features like LOD or Billboard or ProximitySensor, that cannot work in case the same scene instance in rendered in multiple locations on the world.

CameraKnown = False means that CameraChanged was never called, and so camera settings are not known, and so other Camera* properties have undefined values.

Public property CameraDirection: TVector3 read FCameraDirection;
 
Public property CameraUp: TVector3 read FCameraUp;
 
Public property CameraKnown: boolean read FCameraKnown;
 
Public property EnablePhysics: boolean read FEnablePhysics write FEnablePhysics default true;

Yoo can temporarily disable physics (no transformations will be updated by the physics engine) by setting this property to False.


Generated by PasDoc 0.15.0.