Class TCastleMeshCollider

Unit

Declaration

type TCastleMeshCollider = class(TCastleCollider)

Description

Collide as a set of triangles determined by Mesh. Add this collider to TCastleTransform behaviors, along with a TCastleRigidBody, to make the given TCastleTransform be affected by physics and collide with other physics bodies.

Make sure to set the Mesh property.

In the current implementation, this collider supports only static rigid bodies. The associated TCastleRigidBody instance (with the same TCastleTransform parent) will behave as if TCastleRigidBody.Dynamic and TCastleRigidBody.Animated are False.

Hierarchy

Overview

Methods

Protected function CreateKraftShape(const APhysics: TKraft; const ARigidBody: TKraftRigidBody): TKraftShape; override;
Protected procedure DeinitializePhysicsEngineObjects; override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public procedure DesignerWarnings(const SList: TStrings); override;
Public procedure InternalTransformChanged(const TransformChanged: TCastleTransform); override;
Public procedure MeshChanged;

Properties

Published property Mesh: TCastleTransform read FMesh write SetMesh;
Published property DoubleSided: Boolean read FDoubleSided write SetDoubleSided default false;

Description

Methods

Protected function CreateKraftShape(const APhysics: TKraft; const ARigidBody: TKraftRigidBody): TKraftShape; override;

This item has no description.

Protected procedure DeinitializePhysicsEngineObjects; override;

This item has no description.

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 DesignerWarnings(const SList: TStrings); override;

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.

Public procedure InternalTransformChanged(const TransformChanged: TCastleTransform); override;

This item has no description. Showing description inherited from TCastleCollider.InternalTransformChanged.

Notify this collider that given TCastleTransform changed. It can provoke AutoSize recalculation (if Parent changed) or other reactions (e.g. mesh update, if TransformChanged corresponds to Mesh).

Public procedure MeshChanged;

Update the collider triangles to reflect current Mesh shape. This is necessary for physics engine to reflect the Mesh.

We do it automatically in some circumstances (like when you change collider properties, like Mesh or DoubleSided, or when you change TCastleSceneCore.Url) but we don't try to keep the physics mesh follow the triangles every frame (as you really shouldn't change physics mesh so often, it's supposed to be a static collider).

Properties

Published property Mesh: TCastleTransform read FMesh write SetMesh;

Mesh which is used to collide. It can be a TCastleScene, TCastleBox or other instance of TCastleTransform with TCastleTransform.HasColliderMesh = True.

It does not have to be convex.

Note: The values of Mesh.Collides and Mesh.GetCollides of the assigned instance do not matter.

Note: Using the TCollisionNode X3D nodes inside the assigned instance is still useful. This way the scene may collide as something different than it's visible, see https://castle-engine.io/x3d_implementation_navigation.php .

Published property DoubleSided: Boolean read FDoubleSided write SetDoubleSided default false;

Treat both faces sides as collidable. When this is False: Depending on physics engine and situation, the back faces (where the normal doesn't point) may be ignored e.g. by TCastleRigidBody.PhysicsRayCast.


Generated by PasDoc 0.16.0-snapshot.