Class TCastleRigidBody
Unit
Declaration
type TCastleRigidBody = class(TCastleBehavior)
Description
Use this behavior to be affected by physics collisions and forces. Add a TCastleRigidBody and some collider (TCastleCollider descendant) as behaviors of TCastleTransform to make the given TCastleTransform be affected by physics and collide with other physics bodies.
Source: transform/castletransform_physics.inc (line 691).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleBehavior
- TCastleRigidBody
Overview
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 | destructor Destroy; override; |
| Public | procedure CustomSerialization(const SerializationProcess: TSerializationProcess); virtual; |
| Public | function PropertySections(const PropertyName: String): TPropertySections; 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; |
| Public | procedure DesignerWarnings(const SList: TStrings); virtual; |
| Protected | procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); virtual; |
| Protected | procedure BeforeRender( const CameraView: TViewVectors; const ParentParentWorldTransformation: TTransformation); virtual; |
| Protected | procedure ParentChanged; virtual; deprecated 'Use ParentAfterAttach / ParentBeforeDetach or WorldAfterAttach / WorldBeforeDetach'; |
| Protected | procedure ParentAfterAttach; virtual; |
| Protected | procedure ParentBeforeDetach; virtual; |
| Protected | procedure WorldAfterAttach; virtual; |
| Protected | procedure WorldBeforeDetach; virtual; |
| Protected | function CanAttachToParent(const NewParent: TCastleTransform; out ReasonWhyCannot: String): Boolean; virtual; |
| Public | procedure BeforeDestruction; override; |
| Public | function World: TCastleAbstractRootTransform; |
| Protected | procedure WorldAfterAttach; override; |
| Protected | procedure WorldBeforeDetach; override; |
| Protected | procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
| Protected | function CanAttachToParent(const NewParent: TCastleTransform; out ReasonWhyCannot: String): Boolean; override; |
| Public | constructor Create(AOwner: TComponent); override; |
| Public | destructor Destroy; override; |
| Public | procedure Setup2D; |
| Public | function GetCollidingTransforms: TCastleTransformList; |
| Public | function PhysicsRayCast(const RayOrigin, RayDirection: TVector3; const MaxDistance: Single = MaxSingle; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
| Public | function PhysicsSphereCast(const SphereOrigin: TVector3; const SphereRadius:Single; const SphereDirection: TVector3; const MaxDistance: Single = MaxSingle; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
| Public | function PropertySections(const PropertyName: String): TPropertySections; override; |
| Public | procedure AddForceAtPosition(const Force, Position: TVector3); |
| Public | procedure AddForce(const Force: TVector3; const ForceInLocalCoordinates: Boolean); |
| Public | procedure AddTorque(const Torque: TVector3); |
| Public | procedure ApplyImpulse(const Impulse, Point: TVector3); |
| Public | function ExistsInRoot: Boolean; |
| Public | procedure WakeUp; |
| Public | function Awake: Boolean; |
Properties
| Public | property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents; |
| Public | property IsLoading: Boolean read FIsLoading; |
| Public | property Parent: TCastleTransform read FParent; |
| Public | property ListenWorldChange: Boolean
read FListenWorldChange write SetListenWorldChange; |
| Public | property AngularVelocity: TVector3 read FAngularVelocity write SetAngularVelocity; |
| Public | property LinearVelocity: TVector3 read FLinearVelocity write SetLinearVelocity; |
| Public | property InitialAngularVelocity: TVector3 read FAngularVelocity write SetAngularVelocity; deprecated 'use AngularVelocity'; |
| Public | property InitialLinearVelocity: TVector3 read FLinearVelocity write SetLinearVelocity; deprecated 'use LinearVelocity'; |
| Public | property OnCollisionEnter: TCollisionEvent read FOnCollisionEnter write SetOnCollisionEnter; |
| Public | property OnCollisionExit: TCollisionEvent read FOnCollisionExit write SetOnCollisionExit; |
| Public | property OnCollisionStay: TCollisionEvent read FOnCollisionStay write SetOnCollisionStay; |
| Published | property Dynamic: Boolean read FDynamic write SetDynamic default true; |
| Published | property Animated: Boolean read FAnimated write SetAnimated default false; |
| Published | property Trigger: Boolean read FTrigger write SetTrigger default false; |
| Published | property CollisionDetection: TCollisionDetection read FCollisionDetection
write SetCollisionDetection default cdDiscrete; |
| Published | property Layer: TPhysicsLayer read FLayer write SetLayer default 0; |
| Published | property Gravity: Boolean read FGravity write SetGravity default true; |
| Published | property LockTranslation: T3DCoords read FLockTranslation write SetLockTranslation default []; |
| Published | property LockRotation: T3DCoords read FLockRotation write SetLockRotation default []; |
| Published | property Exists: Boolean read FExists write SetExists default true; |
| Published | property AngularVelocityDamp: Single read FAngularVelocityDamp write SetAngularVelocityDamp default 0.1; |
| Published | property MaxAngularVelocity: Single read FMaxAngularVelocity write SetMaxAngularVelocity; |
| Published | property LinearVelocityDamp: Single read FLinearVelocityDamp write SetLinearVelocityDamp default 0.1; |
| Published | property MaxLinearVelocity: Single read FMaxLinearVelocity write SetMaxLinearVelocity; |
| Published | property AngularVelocityPersistent: TCastleVector3Persistent read FAngularVelocityPersistent ; |
| Published | property LinearVelocityPersistent: TCastleVector3Persistent read FLinearVelocityPersistent ; |
Description
Methods
| Protected | function GetInternalText: String; virtual; |
|
This item has no description. | |
| Protected | procedure SetInternalText(const Value: String); virtual; |
|
This item has no description. | |
| Protected | procedure SetName(const Value: TComponentName); override; |
|
This item has no description. | |
| Protected | procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); virtual; |
|
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. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | procedure CustomSerialization(const SerializationProcess: TSerializationProcess); virtual; |
|
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. | |
| Public | function PropertySections(const PropertyName: String): TPropertySections; virtual; |
|
Section where to show property in the editor. | |
| Public | procedure SetTransient; |
|
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 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. | |
| Public | procedure AddNonVisualComponent(const NonVisualComponent: TComponent); |
|
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
| |
| Public | procedure InsertNonVisualComponent(const Index: Integer; const NonVisualComponent: TComponent); |
|
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
| |
| Public | procedure RemoveNonVisualComponent(const NonVisualComponent: TComponent); |
|
Removes the component previously added by AddNonVisualComponent. | |
| Public | function NonVisualComponentsIndexOf(const NonVisualComponent: TComponent): Integer; |
|
Index of the previously added non-visual component. Returns -1 if the component was not found. | |
| Public | function NonVisualComponentsCount: Integer; |
|
Count of components added by AddNonVisualComponent.
See also
| |
| Public | function NonVisualComponentsEnumerate: TNonVisualComponentsEnumerator; |
|
You can enumerate current non-visual components using loop like See also
| |
| Public | function ValueIsStreamed: Boolean; virtual; |
|
Whether the current value of this object should be written to the stream. This should be 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 Descendants that override this to sometimes return The name of this method is consistent with TPropertyEditor.ValueIsStreamed in LCL. | |
| Public | procedure DesignerInfo(const SList: TStrings); virtual; |
|
Override to add information that should be visible at design-time. Call | |
| Public | procedure DesignerWarnings(const SList: TStrings); virtual; |
|
Override to add warnings that should be visible at design-time. Call | |
| Protected | procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); virtual; |
|
Continuously occuring event, for various tasks. Parameters
| |
| Protected | procedure BeforeRender( const CameraView: TViewVectors; const ParentParentWorldTransformation: TTransformation); virtual; |
|
Event called right before rendering the parent TCastleTransform. Override this if you have to adjust the parent transformation strictly before the rendering. Compared to adjusting the parent transformation in e.g. Update, adjusting the parent transformation here has advantages:
For example, adjusting the TCastleTransform done by the TCastleBillboard is done using this method. The transformation in this case is determined by the camera and parent's parent transformation. The transformation has to be applied without any delay (even a 1-frame delay would be visible, as artifacts caused by billboard not perfectly aligned with the camera would be visible – blending sort along camera direction in sort3D is not perfect if billboard doesn't exactly match camera direction). And the transformation with billboard may be present in multiple viewports and/or multiple times in the same viewport tree.
Parameters
| |
| Protected | procedure ParentChanged; virtual; deprecated 'Use ParentAfterAttach / ParentBeforeDetach or WorldAfterAttach / WorldBeforeDetach'; |
|
Warning: this symbol is deprecated: Use ParentAfterAttach / ParentBeforeDetach or WorldAfterAttach / WorldBeforeDetach Called after Parent changed, at the end of TCastleTransform.AddBehavior, TCastleTransform.RemoveBehavior. | |
| Protected | procedure ParentAfterAttach; virtual; |
|
Called after Parent changed, e.g. at the end of TCastleTransform.AddBehavior. | |
| Protected | procedure ParentBeforeDetach; virtual; |
|
Called before Parent changed, e.g. at the beginning of TCastleTransform.RemoveBehavior. This is also called at the destruction of behavior (more precisely from BeforeDestruction now). Even in this case, we guarantee that Parent is still valid during this call, and not in half-destroyed state. Before the actual destructor of TCastleBehavior we do BeforeParentDetach and BeforeWorldDetach and set Parent to | |
| Protected | procedure WorldAfterAttach; virtual; |
|
Called after Parent became part of World. Called only if ListenWorldChange is | |
| Protected | procedure WorldBeforeDetach; virtual; |
|
Called before Parent stops being part of World. Called only if ListenWorldChange is This is also called at the destruction of behavior (more precisely from BeforeDestruction now). Even in this case, we guarantee that Parent is still valid during this call, and not in half-destroyed state. Before the actual destructor of TCastleBehavior we do BeforeParentDetach and BeforeWorldDetach and set Parent to | |
| Protected | function CanAttachToParent(const NewParent: TCastleTransform; out ReasonWhyCannot: String): Boolean; virtual; |
|
Check can this behavior be added to NewParent. When this returns function TCastleBillboard.CanAttachToParent(const NewParent: TCastleTransform; out ReasonWhyCannot: String): Boolean; begin Result := inherited; if not Result then Exit; if NewParent.FindBehavior(TCastleBillboard) <> nil then begin ReasonWhyCannot := 'Only one TCastleBillboard behavior can be added to a given TCastleTransform'; Result := false; end; end; | |
| Public | procedure BeforeDestruction; override; |
|
This item has no description. | |
| Public | function World: TCastleAbstractRootTransform; |
|
Reference to the root transformation (typically matching the TCastleViewport.Items value) corresponding to the parent of this behavior. May be | |
| Protected | procedure WorldAfterAttach; override; |
|
Initializes physics engine objects when TCastleRigidBody is attached to world. | |
| Protected | procedure WorldBeforeDetach; override; |
|
Deinitializes physics engine objects when TCastleRigidBody is attached to world. | |
| Protected | procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
This item has no description. Showing description inherited from TCastleBehavior.Update. Continuously occuring event, for various tasks. | |
| Protected | function CanAttachToParent(const NewParent: TCastleTransform; out ReasonWhyCannot: String): Boolean; override; |
|
Only one TCastleRigidBody behavior can be added to a given TCastleTransform so we check that here. | |
| Public | constructor Create(AOwner: TComponent); override; |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Public | procedure Setup2D; |
|
Utility function to set common values for physics in 2D games. Locks moving along the Z axis, locks rotating along the X and Y axes. | |
| Public | function GetCollidingTransforms: TCastleTransformList; |
|
Transformations that we collide with currently. | |
| Public | function PhysicsRayCast(const RayOrigin, RayDirection: TVector3; const MaxDistance: Single = MaxSingle; 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, MaxDistance are in the parent coordinate system of associated TCastleTransform. For example query like this works naturally: // MyTransform.Translation, MyTransform.Direction // are in MyTransform.Parent coordinate system Hit := MyTransform.RigidBody.PhysicsRayCast( MyTransform.Translation, MyTransform.Direction, MaxDistance);
It returns TRayCastResult, with information there consistently in the same coordinate system as inputs. So TRayCastResult.Distance, TRayCastResult.Point, TRayCastResult.Normal are also in parent coordinate system of associated TCastleTransform. 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. | |
| Public | function PhysicsSphereCast(const SphereOrigin: TVector3; const SphereRadius:Single; const SphereDirection: TVector3; const MaxDistance: Single = MaxSingle; const CollisionLayers: TPhysicsLayers = AllLayers): TRayCastResult; |
|
Check if moving a sphere in the given direction would collide with anything in the world. Suitable to check if moving this rigid body, approximating this body as a sphere, would collide with anything. Returns the TRayCastResult record. Read TRayCastResult.Hit (boolean), TRayCastResult.Transform (guaranteed to be The given SphereOrigin, SphereRadius, SphereDirection, MaxDistance are in the parent coordinate system of associated TCastleTransform. For example query like this works naturally: // MyTransform.Translation, MyTransform.Direction // are in MyTransform.Parent coordinate system Hit := MyTransform.RigidBody.PhysicsSphereCast( MyTransform.Translation, 2, MyTransform.Direction, MaxDistance);
It returns TRayCastResult, with information there consistently in the same coordinate system as inputs. So TRayCastResult.Distance, TRayCastResult.Point, TRayCastResult.Normal are also in parent coordinate system of associated TCastleTransform. Collisions taken / not taken into account:
By default, the sphere 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. | |
| 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. | |
| Public | procedure AddForceAtPosition(const Force, Position: TVector3); |
|
Push this rigid body. The body is pushed from a Position and along the direction of Force. Longer length of Force makes a stronger push. The forces affecting each body are reset every frame (only the body velocity is preserved across frames). If you want to keep applying this force (e.g. it is a wind that continues pushing in given direction) you should call this method every frame. It automatically accounts for the delta time (because the force will actually be applied later, with delta time, to velocity) so no need to multiply the arguments with SecondsPassed. That is, adding force means By changing Position from which you push, you can change the angular velocity, i.e. different Position makes the body spin in different ways. Note that Position too distant from the body center may result in unrealistically strong push. If Position is exactly at body center, then angular velocity will not be affected. Force and Position are in the world coordinate system. | |
| Public | procedure AddForce(const Force: TVector3; const ForceInLocalCoordinates: Boolean); |
|
Push this rigid body. The body is pushed along the direction of Force. Longer length of Force makes a stronger push. This is similar to AddForceAtPosition, but the Force (direction) can be in local or global coordinate system (depending on ForceInLocalCoordinates). Moreover it doesn't take as parameter any Position: the force always acts from the origin of this body. Just like with AddForceAtPosition, the forces affecting each body are reset every frame (only the body velocity is preserved across frames). If you want to keep applying this force (e.g. it is a wind that continues pushing in given direction) you should call this method every frame. It automatically accounts for the delta time (because the force will actually be applied later, with delta time, to velocity) so no need to multiply the arguments with SecondsPassed. | |
| Public | procedure AddTorque(const Torque: TVector3); |
|
Rotate this rigid body with physics. Longer length of Torque makes a stronger push. Torque is in world coordinates. Just like with AddForceAtPosition, the forces affecting each body are reset every frame (only the body velocity is preserved across frames). If you want to keep applying this force (e.g. it is a whirlwind that continues rotating) you should call this method every frame. It automatically accounts for the delta time (because the force will actually be applied later, with delta time, to velocity) so no need to multiply the arguments with SecondsPassed. | |
| Public | procedure ApplyImpulse(const Impulse, Point: TVector3); |
|
Apply a one-time instant increase in speed, that pushes the body (increasing velocity). Impulse is a direction along which to push, Point is the position from which you push. Longer length of Impulse makes a stronger push. Impulse and Point are both in world coordinates. Adding impulse means Same notes as for Position of AddForceAtPosition: By changing Point from which you push, you can change the angular velocity, i.e. different Point makes the body spin in different ways. Note that Point too distant from the body center may result in unrealistically strong push. If Point is exactly at body center, then angular velocity will not be affected. | |
| Public | function ExistsInRoot: Boolean; |
|
Returns true when rigid body behavior exists, and is added to Castle Transform, and this transform | |
| Public | procedure WakeUp; |
|
For performance reasons, physics engine puts the body to "sleep" when it didn't move (too much) in the recent frames. This means the body will not move anymore "by itself", i.e. until something will collide with it. In general, the body should be "woken up" automatically when something collides with it, so the mechanism should be invisible to you, but sometimes it is necessary to wake up a body explicitly. | |
| Public | function Awake: Boolean; |
|
For performance reasons, physics engine puts the body to "sleep" when it didn't move (too much) in the recent frames. Use this to read current state. | |
Properties
| Public | property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents; |
|
Components added by AddNonVisualComponent. | |
| Public | property IsLoading: Boolean read FIsLoading; |
|
Is the component during deserialization now. Note: We can't use | |
| Public | property Parent: TCastleTransform read FParent; |
|
Parent TCastleTransform of this behavior. Change it by doing TCastleTransform.AddBehavior, TCastleTransform.RemoveBehavior.
| |
| Public | property ListenWorldChange: Boolean
read FListenWorldChange write SetListenWorldChange; |
|
Set this to | |
| Public | property AngularVelocity: TVector3 read FAngularVelocity write SetAngularVelocity; |
|
Current rotating velocity of this body. You can query it (as it changes, affected by forces) and set it at any point. In world coordinates. See https://en.wikipedia.org/wiki/Angular_velocity about the exact meaning of angular velocity. The vector direction (AngularVelocity.Normalize) determines the axis around which we rotate. The vector length (AngularVelocity.Length) determines the speed (in radians/second) with which we rotate. | |
| Public | property LinearVelocity: TVector3 read FLinearVelocity write SetLinearVelocity; |
|
Current moving velocity of this body. You can query it (as it changes, affected by forces) and set it at any point. In world coordinates. | |
| Public | property InitialAngularVelocity: TVector3 read FAngularVelocity write SetAngularVelocity; deprecated 'use AngularVelocity'; |
|
Warning: this symbol is deprecated: use AngularVelocity This item has no description. | |
| Public | property InitialLinearVelocity: TVector3 read FLinearVelocity write SetLinearVelocity; deprecated 'use LinearVelocity'; |
|
Warning: this symbol is deprecated: use LinearVelocity This item has no description. | |
| Public | property OnCollisionEnter: TCollisionEvent read FOnCollisionEnter write SetOnCollisionEnter; |
|
Occurs when TCastleRigidBody starts colliding with another TCastleRigidBody. It can occur repeatedly for the same body (in the same time instant) if the collision has many points of contact. Warning: Do not free the related TCastleTransform or TCastleRigidBody or TCastleCollider components upon receiving this event. Right now, it would free an underlying physics engine object, and this would crash the physics engine. Instead, you can:
| |
| Public | property OnCollisionExit: TCollisionEvent read FOnCollisionExit write SetOnCollisionExit; |
|
Occurs when TCastleRigidBody stops colliding with another TCastleRigidBody. Just like at OnCollisionEnter: Do not free the related components upon receiving this event. See the OnCollisionEnter documentation for details of this limitation and solutions. | |
| Public | property OnCollisionStay: TCollisionEvent read FOnCollisionStay write SetOnCollisionStay; |
|
Occurs when TCastleRigidBody still collides with another TCastleRigidBody. Just like at OnCollisionEnter: Do not free the related components upon receiving this event. See the OnCollisionEnter documentation for details of this limitation and solutions. | |
| Published | property Dynamic: Boolean read FDynamic write SetDynamic default true; |
|
Does the physics simulation move and rotate this object (because of gravity, or because it collides with others). When | |
| Published | property Animated: Boolean read FAnimated write SetAnimated default false; |
|
Is the transformation of this object updated often (relevant only when Dynamic = This property is taken into account only if Dynamic = This property is an optimization hint to the physics engine, it says how often you will change the transformation.
| |
| Published | property Trigger: Boolean read FTrigger write SetTrigger default false; |
|
Triggers report when other object collides with them, but still allow the other object to pass through. In other words, colliding with a trigger will not cause the collider to stop or "bounce off" the trigger. They are useful as sensors. E.g. a trigger may be a coin (like in "Mario") that the player can "consume" by colliding with it. Triggers report collisions through the same events as other rigid bodies: (TCastleRigidBody.OnCollisionEnter, TCastleRigidBody.OnCollisionStay, TCastleRigidBody.OnCollisionExit). | |
| Published | property CollisionDetection: TCollisionDetection read FCollisionDetection
write SetCollisionDetection default cdDiscrete; |
|
Sets CollisionDetectionMode in rigid body to Discrete or ContinuousSweep. | |
| Published | property Layer: TPhysicsLayer read FLayer write SetLayer default 0; |
|
Physics layer of the rigid body determines with which other bodies it may collide. The way layers interact is configured in the MyViewport.Items.PhysicsProperties.LayerCollisions. Each layer can also have name and description. You can set them using the MyViewport.Items.PhysicsProperties.LayerNames property. | |
| Published | property Gravity: Boolean read FGravity write SetGravity default true; |
|
Is this object affected by gravity. | |
| Published | property LockTranslation: T3DCoords read FLockTranslation write SetLockTranslation default []; |
|
Disable motion (TCastleTransform.Translation change) along the particular (world) axis. For 2D games, you will usually want to disable motion along the Z axis. Instead of directly changing this property, you can achieve this by calling Setup2D. | |
| Published | property LockRotation: T3DCoords read FLockRotation write SetLockRotation default []; |
|
Disable rotation (TCastleTransform.Rotation change) along the particular (world) axis. For 2D games, you will usually want to disable rotation along the X and Y axes. Instead of directly changing this property, you can achieve this by calling Setup2D. | |
| Published | property Exists: Boolean read FExists write SetExists default true; |
|
Controls whether the rigid body is actually processed by the physics engine. When this is | |
| Published | property AngularVelocityDamp: Single read FAngularVelocityDamp write SetAngularVelocityDamp default 0.1; |
|
Damping means that the velocity will decrease over time. | |
| Published | property MaxAngularVelocity: Single read FMaxAngularVelocity write SetMaxAngularVelocity; |
|
This item has no description. | |
| Published | property LinearVelocityDamp: Single read FLinearVelocityDamp write SetLinearVelocityDamp default 0.1; |
|
Damping means that the velocity will decrease over time. Values from 0.0 up to infinity make sense. Exact interpretation: The damping is applied every "physics frame" following this equation:
Where In effect, damping = 0 means that no damping occurs. Damping values > 0 means that LinearVelocity decreases with time, larger The meaning of damping = 1.0 depends on Viewport.Items.PhysicsProperties.Frequency:
| |
| Published | property MaxLinearVelocity: Single read FMaxLinearVelocity write SetMaxLinearVelocity; |
|
This item has no description. | |
| Published | property AngularVelocityPersistent: TCastleVector3Persistent read FAngularVelocityPersistent ; |
|
AngularVelocity 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 AngularVelocity directly. See also
| |
| Published | property LinearVelocityPersistent: TCastleVector3Persistent read FLinearVelocityPersistent ; |
|
LinearVelocity 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 LinearVelocity directly. See also
| |
Generated by PasDoc 0.17.0.snapshot.