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 theCollisionHandler
.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
- 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 aCollisionTraverser
via add_collider().
- property from_node_path NodePath
Returns the
NodePath
that represents theCollisionNode
that contains theCollisionSolid
that triggered this collision. This will be aNodePath
that has been added to aCollisionTraverser
via add_collider().
- property from_solid CollisionSolid
Returns the
CollisionSolid
pointer for the particular solid that triggered this collision.
- 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.
- 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.
- static getClassType() TypeHandle
- 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.
- 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.
- getFrom() CollisionSolid
Returns the
CollisionSolid
pointer for the particular solid that triggered this collision.
- getFromNode() CollisionNode
Returns the node that contains the
CollisionSolid
that triggered this collision. This will be a node that has been added to aCollisionTraverser
via add_collider().
- getFromNodePath() NodePath
Returns the
NodePath
that represents theCollisionNode
that contains theCollisionSolid
that triggered this collision. This will be aNodePath
that has been added to aCollisionTraverser
via add_collider().
- 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.
- 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 normalCollisionSolid
collision; seehasInto()
.
- getIntoNode() PandaNode
Returns the node that contains the
CollisionSolid
that was collided into. This returns aPandaNode
pointer instead of something more specific, because it might be either aCollisionNode
or aGeomNode
.Also see
getIntoNodePath()
.
- getIntoNodePath() NodePath
Returns the
NodePath
that represents the specificCollisionNode
orGeomNode
instance that was collided into. This is the same node returned bygetIntoNode()
, represented as aNodePath
; however, it may be more useful because theNodePath
can resolve the particular instance of the node, if there is more than one.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- hasInto() bool
Returns true if the “into” solid is, in fact, a
CollisionSolid
, and its pointer is known (in which casegetInto()
may be called to retrieve it). If this returns false, the collision was detected into aGeomNode
, and there is noCollisionSolid
pointer to be retrieved.
- 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.
- 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.
- property into_node PandaNode
Returns the node that contains the
CollisionSolid
that was collided into. This returns aPandaNode
pointer instead of something more specific, because it might be either aCollisionNode
or aGeomNode
.Also see
getIntoNodePath()
.
- property into_node_path NodePath
Returns the
NodePath
that represents the specificCollisionNode
orGeomNode
instance that was collided into. This is the same node returned bygetIntoNode()
, represented as aNodePath
; however, it may be more useful because theNodePath
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 normalCollisionSolid
collision; seehasInto()
.
- resetCollided()
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.
- setContactNormal(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.
- setContactPos(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.
- setInteriorPoint(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.
- setSurfaceNormal(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.
- setSurfacePoint(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.