Class TSceneNodeAnimatorCollisionResponse

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TSceneNodeAnimatorCollisionResponse = class(TSceneNodeAnimator)

Description

Special scene node animator for doing automatic collision detection and response.
This scene node animator can be attached to any single scene node and will then prevent it from moving through specified collision geometry (e.g. walls and floors of the) world, as well as having it fall under gravity. This animator provides a simple implementation of first person shooter cameras. Attach it to a camera, and the camera will behave as the player control in a first person shooter game: The camera stops and slides at walls, walks up stairs, falls down if there is no floor under it, and so on.
The animator will treat any change in the position of its target scene node as movement, including setting Position, as movement. If you want to teleport the target scene node manually to a location without it being effected by collision geometry, then call SetTargetNode(node) after setting node.Position.

Hierarchy

Overview

Methods

Public constructor Create(NReference: Pointer; NSceneManager: TReferenceCounted; AutoDrop: Boolean = False);
Public function GetCollisionNode: TSceneNode; inline;
Public function GetTargetNode: TSceneNode; inline;
Public function GetWorld: TTriangleSelector; inline;
Public function IsFalling: Boolean; inline;
Public procedure Jump(JumpSpeed: Single); inline;
Public procedure SetCollisionCallback(Callback: TCollisionCallback); inline;
Public procedure SetTargetNode(Node: TSceneNode); inline;
Public procedure SetWorld(World: TTriangleSelector); inline;

Properties

Public property AnimateTarget: Boolean read GetAnimateTarget write SetAnimateTarget;
Public property CollisionOccurred: Boolean read GetCollisionOccurred;
Public property CollisionPoint: TVector3D read GetCollisionPoint;
Public property CollisionResultPosition: TVector3D read GetCollisionResultPosition;
Public property CollisionTriangle: TTriangle read GetCollisionTriangle;
Public property EllipsoidRadius: TVector3D read GetEllipsoidRadius write SetEllipsoidRadius;
Public property EllipsoidTranslation: TVector3D read GetEllipsoidTranslation write SetEllipsoidTranslation;
Public property Gravity: TVector3D read GetGravity write SetGravity;
Public property SceneManager: TReferenceCounted read FSceneManager;

Description

Methods

Public constructor Create(NReference: Pointer; NSceneManager: TReferenceCounted; AutoDrop: Boolean = False);

Constructor. Only used internally.

Public function GetCollisionNode: TSceneNode; inline;

The translation of the ellipsoid for collision detection.

Public function GetTargetNode: TSceneNode; inline;

The single node that this animator is acting on.

Public function GetWorld: TTriangleSelector; inline;

The current triangle selector containing all triangles for collision detection.

Public function IsFalling: Boolean; inline;

Checks if the attached scene node is falling.
Falling means that there is no blocking wall from the scene node in the direction of the gravity. The implementation of this method is very fast, no collision detection is done when invoking it.

Returns

True if the scene node is falling, false if not.

Public procedure Jump(JumpSpeed: Single); inline;

'Jump' by adding a jump speed opposite to its gravity.

Parameters
JumpSpeed
The initial speed of the jump; the velocity will be opposite to this animator's gravity vector.
Public procedure SetCollisionCallback(Callback: TCollisionCallback); inline;

Sets a callback interface which will be called if a collision occurs. occurs. Set this to nil to disable the callback.

Parameters
Callback
Collision callback handler that will be called when a collision
Public procedure SetTargetNode(Node: TSceneNode); inline;

Set the single node that this animator will act on.

Parameters
Node
The new target node. Setting this will force the animator to update its last target position for the node, allowing position setting to teleport the node through collision geometry.
Public procedure SetWorld(World: TTriangleSelector); inline;

Sets a triangle selector holding all triangles of the world with which the scene node may collide.

Parameters
World
New triangle selector containing triangles to let the scene node collide with.

Properties

Public property AnimateTarget: Boolean read GetAnimateTarget write SetAnimateTarget;

Specifies whether the target should react to a collision.

Public property CollisionOccurred: Boolean read GetCollisionOccurred;

True if a collision occurred during the last AnimateNode().

Public property CollisionPoint: TVector3D read GetCollisionPoint;

The last point of collision.

Public property CollisionResultPosition: TVector3D read GetCollisionResultPosition;

The position that the target node will be moved to, unless the collision is consumed in a callback.
If you have a collision callback registered, and it consumes the collision, then the node will ignore the collision and will not stop at this position. Instead, it will move fully to the position that caused the collision to occur.

Public property CollisionTriangle: TTriangle read GetCollisionTriangle;

The last triangle that caused a collision.

Public property EllipsoidRadius: TVector3D read GetEllipsoidRadius write SetEllipsoidRadius;

The radius of the ellipsoid for collision detection and response.

Public property EllipsoidTranslation: TVector3D read GetEllipsoidTranslation write SetEllipsoidTranslation;

The translation of the ellipsoid for collision detection.

Public property Gravity: TVector3D read GetGravity write SetGravity;

The gravity vector.

Public property SceneManager: TReferenceCounted read FSceneManager;

The owning scene manager.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22