Class TRayCollision

Unit

Declaration

type TRayCollision = class(specialize TStructList<TRayCollisionNode>)

Description

Represents a ray collision with a 3D objects tree. Just access the First item for the collision information with the final 3D object. The rest of items are containers of this 3D object (a path within TCastleViewport.Items hierarchy tree, usually).

This list is a path in the TCastleTransform tree leading from the final colliding object (usually TCastleScene) to the root of the TCastleTransform tree. This allows you to track the TCastleTransform containers that contain given collision.

This is never an empty list when returned by RayCollision.

Hierarchy

Overview

Fields

Public Distance: Single;

Methods

Public function IndexOfItem(const Item: TCastleTransform): Integer; overload;
Public function IndexOfItem(const ItemClass: TCastleTransformClass): Integer; overload;

Description

Fields

Public Distance: Single;

Distance, in world coordinate system, from the current camera to the picked point. The suggested usage is to decide if player is close enough to reach the 3D object — for example, you may not want to allow player to open a door by clicking on it from a far distance.

If the ray hit empty space, the distance is MaxSingle. Such case may occur because, once TCastleTransform handles TCastleTransform.PointingDevicePress, we make sure to inform it about PointingDeviceMove and PointingDeviceRelease, regardless if ray still hits this TCastleTransform instance.

Methods

Public function IndexOfItem(const Item: TCastleTransform): Integer; overload;

Index of node with given Item, -1 if none.

Public function IndexOfItem(const ItemClass: TCastleTransformClass): Integer; overload;

Index of node with given ItemClass, -1 if none.


Generated by PasDoc 0.16.0.