Class TCastleAbstractRootTransform
Unit
Declaration
type TCastleAbstractRootTransform = class(TCastleTransform)
Description
Root of transformations and scenes (tree of TCastleTransform and TCastleScene). This is the base abstract class, the non-abstract descendant is TCastleRootTransform.
Source: transform/castletransform_abstractroottransform.inc (line 23).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleTransform
- TCastleAbstractRootTransform
Overview
Fields
| Public | InternalOnNodesFree: TNotifyEvent; |
| Public | InternalVisibleStateId: TFrameId; |
| Public | InternalVisibleGeometryStateId: TFrameId; |
| Public | InternalVisibleNonGeometryStateId: TFrameId; |
Methods
| Protected | function IgnoreTransparentItem( const Sender: TObject; const Triangle: PTriangle): Boolean; virtual; abstract; |
| 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 CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
| Public | procedure UpdateIncreaseTime(const SecondsPassed: Single); |
| Public | function GravityCoordinate: Integer; |
| Public | function GravityUp: TVector3; |
| 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; |
| Public | function WorldMoveAllowed( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; |
| Public | function WorldHeight(const APosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; |
| Public | function WorldLineOfSight(const Pos1, Pos2: TVector3): boolean; |
| Public | function WorldRay(const RayOrigin, RayDirection: TVector3): TRayCollision; |
| Public | function WorldRayCast(const RayOrigin, RayDirection: TVector3; out Distance: Single): TCastleTransform; overload; |
| Public | function WorldRayCast(const RayOrigin, RayDirection: TVector3): TCastleTransform; overload; |
| Public | function WorldBoxCollision(const Box: TBox3D): boolean; |
| Public | function WorldSegmentCollision(const Pos1, Pos2: TVector3): 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 | function PhysicsRayCast(const RayOrigin, RayDirection: TVector3; const MaxDistance: Single = MaxSingle; const IgnoreBody: TCastleRigidBody = nil; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
| Public | function PhysicsSphereCast(const SphereOrigin: TVector3; const SphereRadius:Single; const SphereDirection: TVector3; const MaxDistance: Single = MaxSingle; const IgnoreBody: TCastleRigidBody = nil; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
| Public | procedure ClearExceptCameras; |
Properties
| Public | property EnablePhysics: boolean read FEnablePhysics write FEnablePhysics
default true; |
| Public | property MoveLimit: TBox3D read FMoveLimit write FMoveLimit; |
| Public | property MainCamera: TCastleCamera read FMainCamera write SetMainCamera; |
| Published | property PhysicsProperties: TPhysicsProperties read FPhysicsProperties; |
| Published | property TimeScale: Single read FTimeScale write FTimeScale default 1; |
| Published | property Paused: boolean read FPaused write SetPaused default false; |
Description
Fields
| Public | InternalOnNodesFree: TNotifyEvent; |
|
This item has no description. Source: transform/castletransform_abstractroottransform.inc (line 59). | |
| Public | InternalVisibleStateId: TFrameId; |
|
Latest frame when VisibleChangeNotification was called (with any params, even empty). Source: transform/castletransform_abstractroottransform.inc (line 77). | |
| Public | InternalVisibleGeometryStateId: TFrameId; |
|
Latest frame when VisibleChangeNotification was called (with vcVisibleGeometry). Source: transform/castletransform_abstractroottransform.inc (line 79). | |
| Public | InternalVisibleNonGeometryStateId: TFrameId; |
|
Latest frame when VisibleChangeNotification was called (with vcVisibleNonGeometry). Source: transform/castletransform_abstractroottransform.inc (line 81). | |
Methods
| Protected | function IgnoreTransparentItem( const Sender: TObject; const Triangle: PTriangle): Boolean; virtual; abstract; |
|
Ignore (return This is suitable for TTriangleIgnoreFunc function, you can pass this to RayCollision and such. Source: transform/castletransform_abstractroottransform.inc (line 56). | |
| Public | constructor Create(AOwner: TComponent); override; |
|
This item has no description. Source: transform/castletransform_abstractroottransform.inc (line 83). | |
| Public | destructor Destroy; override; |
|
This item has no description. Source: transform/castletransform_abstractroottransform.inc (line 84). | |
| 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: transform/castletransform_abstractroottransform.inc (line 85). | |
| 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: transform/castletransform_abstractroottransform.inc (line 86). | |
| Public | procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
|
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: transform/castletransform_abstractroottransform.inc (line 87). | |
| Public | procedure UpdateIncreaseTime(const SecondsPassed: Single); |
|
Update everything when time passes, in particular updating physics. This makes physics recalculation and updates rigid bodies transformations. It also calls any other TCastleTransform.Update work. Use this to simulate the passage of time without actually displaying the updated viewport. Useful e.g. to record the physics simulation results (to later play them back), see https://github.com/castle-engine/castle-dice-throwing . Contrary to just Update, this always makes the processing, doesn't check did TFramesPerSecond.FrameId changed. This also doesn't check Exists, so can be called even on non-existing viewport. Source: transform/castletransform_abstractroottransform.inc (line 102). | |
| Public | function GravityCoordinate: Integer; |
|
The major axis of gravity vector: 0, 1 or 2. This is trivially derived from the known camera 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. Source: transform/castletransform_abstractroottransform.inc (line 120). | |
| Public | function GravityUp: TVector3; |
|
This item has no description. Source: transform/castletransform_abstractroottransform.inc (line 122). | |
| 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; |
|
Is the move from OldPos to ProposedNewPos possible. Returns true and sets NewPos if some move is allowed, thus allows for wall-sliding. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal If your query originates from some existing TCastleTransform instance, you should prefer to instead use TCastleTransform.MoveAllowed method, that automatically prevents "collisions with yourself". See also
Source: transform/castletransform_abstractroottransform.inc (line 142). | |
| Public | function WorldMoveAllowed( const OldPos, NewPos: TVector3; const IsRadius: boolean; const Radius: Single; const OldBox, NewBox: TBox3D; const BecauseOfGravity: boolean): boolean; overload; |
|
Is the move from OldPos to NewPos possible. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal If your query originates from some existing TCastleTransform instance, you should prefer to instead use TCastleTransform.MoveAllowed method, that automatically prevents "collisions with yourself". See also
Source: transform/castletransform_abstractroottransform.inc (line 161). | |
| Public | function WorldHeight(const APosition: TVector3; out AboveHeight: Single; out AboveGround: PTriangle): boolean; |
|
Get height of point APosition above the world. Looks at current MainCamera to know the gravity direction. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal If your query originates from some existing TCastleTransform instance, you should prefer to instead use TCastleTransform.MoveAllowed method, that automatically prevents "collisions with yourself". Source: transform/castletransform_abstractroottransform.inc (line 179). | |
| Public | function WorldLineOfSight(const Pos1, Pos2: TVector3): boolean; |
|
Check that the line segment between 2 points that not collide with anything (that has opaque material). This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 190). | |
| Public | function WorldRay(const RayOrigin, RayDirection: TVector3): TRayCollision; |
|
First object hit by the ray. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 199). | |
| Public | function WorldRayCast(const RayOrigin, RayDirection: TVector3; out Distance: Single): TCastleTransform; overload; |
|
First object hit by the ray. 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 Source: transform/castletransform_abstractroottransform.inc (line 209). | |
| Public | function WorldRayCast(const RayOrigin, RayDirection: TVector3): TCastleTransform; overload; |
|
This item has no description. Source: transform/castletransform_abstractroottransform.inc (line 211). | |
| Public | function WorldBoxCollision(const Box: TBox3D): boolean; |
|
Check whether something collides with axis-aligned box in 3D. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 222). | |
| Public | function WorldSegmentCollision(const Pos1, Pos2: TVector3): boolean; |
|
Check whether something collides with a line segment. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 231). | |
| Public | function WorldSphereCollision(const Pos: TVector3; const Radius: Single): boolean; |
|
Check whether something collides with a sphere. This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 240). | |
| Public | function WorldSphereCollision2D(const Pos: TVector2; const Radius: Single; const Details: TCollisionDetails = nil): boolean; |
|
Check whether something collides with a sphere in 2D (a circle, extruded to infinity along the Z axis). This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 250). | |
| Public | function WorldPointCollision2D(const Point: TVector2): boolean; |
|
Check whether something collides with a point in 2D (which is an infinite line along the Z axis in 3D). This checks collisions with world (everything inside this TCastleAbstractRootTransform). This checks collision with all objects that have Collides and Exists equal Source: transform/castletransform_abstractroottransform.inc (line 261). | |
| Public | function PhysicsRayCast(const RayOrigin, RayDirection: TVector3; const MaxDistance: Single = MaxSingle; const IgnoreBody: TCastleRigidBody = nil; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
|
First object hit by the ray, calculated using the physics engine. Returns the TRayCastResult record. Read TRayCastResult.Hit (boolean), TRayCastResult.Transform (guaranteed to be The given RayOrigin, RayDirection, Distance are in the world coordinate system. It returns TRayCastResult, with information there also in the world coordinate system. Collisions taken / not taken into account:
By default, the ray hits all physics layers, but you can choose physics layers in CollisionLayers attribute. Note: The TCastleTransform.Pickable property is ignored by this method, i.e. it considers all colliders regardless of their TCastleTransform.Pickable value. The TCastleTransform.Pickable is only taken into account by the routines of the old physics system (see https://castle-engine.io/physics#_old_system_for_collisions_and_gravity ). In the new system, a similar role is filled by physics layers. Source: transform/castletransform_abstractroottransform.inc (line 294). | |
| Public | function PhysicsSphereCast(const SphereOrigin: TVector3; const SphereRadius:Single; const SphereDirection: TVector3; const MaxDistance: Single = MaxSingle; const IgnoreBody: TCastleRigidBody = nil; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
|
Check if moving a sphere in the given direction would collide with anything in the world. Returns the TRayCastResult record. Read TRayCastResult.Hit (boolean), TRayCastResult.Transform (guaranteed to be The given SphereOrigin, SphereRadius, SphereDirection, MaxDistance are in the world coordinate system. It returns TRayCastResult, with information there also in the world coordinate system. Collisions taken / not taken into account:
By default, the sphere cast hits all physics layers, but you can choose physics layers in CollisionLayers attribute. Note: The TCastleTransform.Pickable property is ignored by this method, i.e. it considers all colliders regardless of their TCastleTransform.Pickable value. The TCastleTransform.Pickable is only taken into account by the routines of the old physics system (see https://castle-engine.io/physics#_old_system_for_collisions_and_gravity ). In the new system, a similar role is filled by physics layers. Source: transform/castletransform_abstractroottransform.inc (line 335). | |
| Public | procedure ClearExceptCameras; |
|
Remove all items except TCastleCamera instances. This only avoids removing TCastleCamera instances that are direct children of this TCastleAbstractRootTransform, the TCastleCamera instances that are deeper (e.g. TCastleCamera inside some TCastleTransform) will still be removed. Source: transform/castletransform_abstractroottransform.inc (line 418). | |
Properties
| 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 Source: transform/castletransform_abstractroottransform.inc (line 342). | |
| Public | property MoveLimit: TBox3D read FMoveLimit write FMoveLimit; |
|
Limit the movement allowed by WorldMoveAllowed. Ignored when empty (default). This property allows to easily limit the possible places where player and creatures go. Player is honoring this if it uses WorldMoveAllowed, in particular our TCastleWalkNavigation navigation honors it. Creatures honor it if they use WorldMoveAllowed for their decision. Source: transform/castletransform_abstractroottransform.inc (line 353). | |
| Public | property MainCamera: TCastleCamera read FMainCamera write SetMainCamera; |
|
Central camera, that controls the features that require a single "main" camera (features that do not make sense with multiple cameras from multiple viewports). This camera controls:
Note that it means that "headlight" done by TCastleRootTransform.UseHeadlight is assigned to one camera in case of multiple viewports looking at the same world. You cannot have a different "headlight" in each viewport, this would cause subtle problems since it's not how it would work in reality (where every light is visible in all viewports), e.g. mirror textures (like GeneratedCubeMapTexture) would need different contents in different viewpoints. Note that we no longer advise using TCastleRootTransform.UseHeadlight for headlight. It's easier to just place light as child of whatever camera you want, like adding TCastleDirectionalLight as child of TCastleCamera. See examples/viewport_and_scenes/headlight/ . In this case Note that features like LOD or Billboard or ProximitySensor need to transform this camera to scene local space. Which is not possible if the same scene instance is used multiple times (e.g. under many different TCastleTransform parents). If you need to use these features of TCastleScene, then simply do not use the same scene reference multiple times (instead clone the scene by TCastleScene.Clone). By default this is set to TCastleViewport.Camera of the TCastleViewport that created this TCastleAbstractRootTransform instance. And if something changes the TCastleViewport.Camera of that viewport, then this Source: transform/castletransform_abstractroottransform.inc (line 412). | |
| Published | property PhysicsProperties: TPhysicsProperties read FPhysicsProperties; |
|
Adjust physics properties. Source: transform/castletransform_abstractroottransform.inc (line 421). | |
| Published | property TimeScale: Single read FTimeScale write FTimeScale default 1; |
|
Time scale used when not Paused. Source: transform/castletransform_abstractroottransform.inc (line 424). | |
| Published | property Paused: boolean read FPaused write SetPaused default false; |
|
Pausing means that no events (key, mouse, update) are processed. So time doesn't move, and input is not processed. Navigation also doesn't work (this part is implemented by TCastleViewport and each TCastleNavigation). This is useful if you want to unconditionally make your world temporary still (for example, useful when entering some modal dialog box and you want the world to behave as a still background). See also: For other pausing methods, there are other methods of pausing / disabling some events processing for the world:
Source: transform/castletransform_abstractroottransform.inc (line 462). | |
Generated by PasDoc 0.17.0.snapshot.