CollisionEntry

from panda3d.core import CollisionEntry
class CollisionEntry

Bases:

Bases: TypedWritableReferenceCount

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

Inheritance diagram of CollisionEntry

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

property from_node 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().

property from_node_path 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().

property from_solid CollisionSolid

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

get_all(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.

get_all_contact_info(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.

static get_class_type() TypeHandle
get_contact_normal(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.

get_contact_pos(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.

get_from() CollisionSolid

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

get_from_node() 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().

get_from_node_path() 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().

get_interior_point(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.

get_into() 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 has_into().

get_into_node() 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 get_into_node_path().

get_into_node_path() NodePath

Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. This is the same node returned by get_into_node(), 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.

get_respect_prev_transform() 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.

get_surface_normal(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.

get_surface_point(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.

get_t() float

returns time value for this collision relative to other CollisionEntries

has_contact_normal() bool

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

has_contact_pos() bool

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

has_interior_point() bool

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

has_into() bool

Returns true if the “into” solid is, in fact, a CollisionSolid, and its pointer is known (in which case get_into() 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.

has_surface_normal() bool

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

has_surface_point() bool

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

property into_node 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 get_into_node_path().

property into_node_path NodePath

Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. This is the same node returned by get_into_node(), 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.

property into_solid 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 has_into().

output(out: ostream)
reset_collided()

prepare for another collision test

property respect_prev_transform 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.

set_contact_normal(normal: LVector3)

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

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

set_contact_pos(pos: LPoint3)

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.

set_interior_point(point: LPoint3)

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.

set_surface_normal(normal: LVector3)

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.

set_surface_point(point: LPoint3)

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.

set_t(t: float)

Sets a time value for this collision relative to other CollisionEntries

property t float
Getter

returns time value for this collision relative to other CollisionEntries

Setter

Sets a time value for this collision relative to other CollisionEntries

write(out: ostream, indent_level: int)