# panda3d.core.CollisionEntry¶

class CollisionEntry

Defines a single collision event. One of these is created for each collision detected by a CollisionTraverser, to be dealt with by the CollisionHandler.

A CollisionEntry provides slots for a number of data values (such as intersection point and normal) that might or might not be known for each collision. It is up to the handler to determine what information is known and to do the right thing with it.

Inheritance diagram

getFrom() → CollisionSolid

Returns the CollisionSolid pointer for the particular solid that triggered this collision.

Return type

CollisionSolid

hasInto() → bool

Returns true if the “into” solid is, in fact, a CollisionSolid, and its pointer is known (in which case getInto() may be called to retrieve it). If this returns false, the collision was detected into a GeomNode, and there is no CollisionSolid pointer to be retrieved.

getInto() → CollisionSolid

Returns the CollisionSolid pointer for the particular solid was collided into. This pointer might be NULL if the collision was into a piece of visible geometry, instead of a normal CollisionSolid collision; see hasInto().

Return type

CollisionSolid

getFromNode() → CollisionNode

Returns the node that contains the CollisionSolid that triggered this collision. This will be a node that has been added to a CollisionTraverser via add_collider().

Return type

CollisionNode

getIntoNode() → PandaNode

Returns the node that contains the CollisionSolid that was collided into. This returns a PandaNode pointer instead of something more specific, because it might be either a CollisionNode or a GeomNode.

Also see getIntoNodePath().

Return type

PandaNode

getFromNodePath() → NodePath

Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggered this collision. This will be a NodePath that has been added to a CollisionTraverser via add_collider().

Return type

NodePath

getIntoNodePath() → NodePath

Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. This is the same node returned by getIntoNode(), represented as a NodePath; however, it may be more useful because the NodePath can resolve the particular instance of the node, if there is more than one.

Return type

NodePath

setT(t: float) → None

Sets a time value for this collision relative to other CollisionEntries

getT() → float

returns time value for this collision relative to other CollisionEntries

collided() → bool

returns true if this represents an actual collision as opposed to a potential collision, needed for iterative collision resolution where path of collider changes mid-frame

resetCollided() → None

prepare for another collision test

getRespectPrevTransform() → bool

Returns true if the collision was detected by a CollisionTraverser whose respect_prev_transform flag was set true, meaning we should consider motion significant in evaluating collisions.

setSurfacePoint(point: LPoint3) → None

Stores the point, on the surface of the “into” object, at which a collision is detected.

This point is specified in the coordinate space of the “into” object.

setSurfaceNormal(normal: LVector3) → None

Stores the surface normal of the “into” object at the point of the intersection.

This normal is specified in the coordinate space of the “into” object.

setInteriorPoint(point: LPoint3) → None

Stores the point, within the interior of the “into” object, which represents the depth to which the “from” object has penetrated. This can also be described as the intersection point on the surface of the “from” object (which is inside the “into” object).

This point is specified in the coordinate space of the “into” object.

hasSurfacePoint() → bool

Returns true if the surface point has been specified, false otherwise. See getSurfacePoint(). Some types of collisions may not compute the surface point.

hasSurfaceNormal() → bool

Returns true if the surface normal has been specified, false otherwise. See getSurfaceNormal(). Some types of collisions may not compute the surface normal.

hasInteriorPoint() → bool

Returns true if the interior point has been specified, false otherwise. See getInteriorPoint(). Some types of collisions may not compute the interior point.

setContactPos(pos: LPoint3) → None

Stores the position of the “from” object at the instant at which the collision is first detected.

This position is specified in the coordinate space of the “into” object.

setContactNormal(normal: LVector3) → None

Stores the surface normal of the “into” object at the contact pos.

This normal is specified in the coordinate space of the “into” object.

hasContactPos() → bool

Returns true if the contact position has been specified, false otherwise. See getContactPos(). Some types of collisions may not compute the contact pos.

hasContactNormal() → bool

Returns true if the contact normal has been specified, false otherwise. See getContactNormal(). Some types of collisions may not compute the contact normal.

getSurfacePoint(space: NodePath) → LPoint3

Returns the point, on the surface of the “into” object, at which a collision is detected. This can be thought of as the first point of intersection. However the contact point is the actual first point of intersection.

The point will be converted into whichever coordinate space the caller specifies.

Return type

LPoint3

getSurfaceNormal(space: NodePath) → LVector3

Returns the surface normal of the “into” object at the point at which a collision is detected.

The normal will be converted into whichever coordinate space the caller specifies.

Return type

LVector3

getInteriorPoint(space: NodePath) → LPoint3

Returns the point, within the interior of the “into” object, which represents the depth to which the “from” object has penetrated. This can also be described as the intersection point on the surface of the “from” object (which is inside the “into” object). It can be thought of as the deepest point of intersection.

The point will be converted into whichever coordinate space the caller specifies.

Return type

LPoint3

getAll(space: NodePath, surface_point: LPoint3, surface_normal: LVector3, interior_point: LPoint3) → bool

Simultaneously transforms the surface point, surface normal, and interior point of the collision into the indicated coordinate space.

Returns true if all three properties are available, or false if any one of them is not.

getContactPos(space: NodePath) → LPoint3

Returns the position of the “from” object at the instant that a collision is first detected.

The position will be converted into whichever coordinate space the caller specifies.

Return type

LPoint3

getContactNormal(space: NodePath) → LVector3

Returns the surface normal of the “into” object at the contact position.

The normal will be converted into whichever coordinate space the caller specifies.

Return type

LVector3

getAllContactInfo(space: NodePath, contact_pos: LPoint3, contact_normal: LVector3) → bool

Simultaneously transforms the contact position and contact normal of the collision into the indicated coordinate space.

Returns true if all three properties are available, or false if any one of them is not.

output(out: ostream) → None
write(out: ostream, indent_level: int) → None
static getClassType() → TypeHandle
Return type

TypeHandle

property from_solid

Returns the CollisionSolid pointer for the particular solid that triggered this collision.

Return type

CollisionSolid

property into_solid

Returns the CollisionSolid pointer for the particular solid was collided into. This pointer might be NULL if the collision was into a piece of visible geometry, instead of a normal CollisionSolid collision; see hasInto().

Return type

CollisionSolid

property from_node

Returns the node that contains the CollisionSolid that triggered this collision. This will be a node that has been added to a CollisionTraverser via add_collider().

Return type

CollisionNode

property into_node

Returns the node that contains the CollisionSolid that was collided into. This returns a PandaNode pointer instead of something more specific, because it might be either a CollisionNode or a GeomNode.

Also see getIntoNodePath().

Return type

PandaNode

property from_node_path

Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggered this collision. This will be a NodePath that has been added to a CollisionTraverser via add_collider().

Return type

NodePath

property into_node_path

Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. This is the same node returned by getIntoNode(), represented as a NodePath; however, it may be more useful because the NodePath can resolve the particular instance of the node, if there is more than one.

Return type

NodePath

property t
Getter

returns time value for this collision relative to other CollisionEntries

Setter

Sets a time value for this collision relative to other CollisionEntries

Return type

float

property respect_prev_transform

Returns true if the collision was detected by a CollisionTraverser whose respect_prev_transform flag was set true, meaning we should consider motion significant in evaluating collisions.

Return type

bool