panda3d.core.CollisionNode

from panda3d.core import CollisionNode
class CollisionNode

Bases: PandaNode

A node in the scene graph that can hold any number of CollisionSolids. This may either represent a bit of static geometry in the scene that things will collide with, or an animated object twirling around in the world and running into things.

Inheritance diagram

Inheritance diagram of CollisionNode

__init__(name: str) → None
setCollideMask(mask: CollideMask) → None

Simultaneously sets both the “from” and “into” CollideMask values to the same thing.

setFromCollideMask(mask: CollideMask) → None

Sets the “from” CollideMask. In order for a collision to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

setIntoCollideMask(mask: CollideMask) → None

Sets the “into” CollideMask. In order for a collision to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

getFromCollideMask() → CollideMask

Returns the current “from” CollideMask. In order for a collision to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

Return type

CollideMask

getIntoCollideMask() → CollideMask

Returns the current “into” CollideMask. In order for a collision to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

Return type

CollideMask

clearSolids() → None

Removes all solids from the node.

getNumSolids() → size_t
Return type

size_t

getSolid(n: size_t) → CollisionSolid
Return type

CollisionSolid

modifySolid(n: size_t) → CollisionSolid
Return type

CollisionSolid

setSolid(n: size_t, solid: CollisionSolid) → None

Replaces the solid with the indicated index.

insertSolid(n: size_t, solid: CollisionSolid) → None

Inserts the indicated solid to the node at the indicated position.

removeSolid(n: size_t) → None

Removes the solid with the indicated index. This will shift all subsequent indices down by one.

addSolid(solid: CollisionSolid) → size_t

Adds the indicated solid to the node. Returns the index of the new solid within the node’s list of solids.

Return type

size_t

getColliderSort() → int

Returns the collider_sort value that has been set for this particular node. See setColliderSort().

setColliderSort(sort: int) → None

Sets a particular collider_sort value on this node. This controls the order in which colliders (that is, “from nodes”) are grouped together for the collision traversal.

If there are 32 or fewer colliders added to any particular CollisionTraverser, then this value has no meaning. It is only useful if there are many colliders, which may force the CollisionTraverser to make multiple passes through the data; in that case, it may be a useful optimization to group colliders that have similar bounding volumes together (by giving them similar sort values).

static getDefaultCollideMask() → CollideMask

Returns the default into_collide_mask assigned to new CollisionNodes.

Return type

CollideMask

static getClassType() → TypeHandle
Return type

TypeHandle

getSolids() → list
property from_collide_mask
Getter

Returns the current “from” CollideMask. In order for a collision to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

Setter

Sets the “from” CollideMask. In order for a collision to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

Return type

CollideMask

property into_collide_mask
Getter

Returns the current “into” CollideMask. In order for a collision to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

Setter

Sets the “into” CollideMask. In order for a collision to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

Return type

CollideMask

property solids

Getter Setter

Replaces the solid with the indicated index.

Return type

Sequence[ConstPointerTo_CollisionSolid]

property collider_sort
Getter

Returns the collider_sort value that has been set for this particular node. See setColliderSort().

Setter

Sets a particular collider_sort value on this node. This controls the order in which colliders (that is, “from nodes”) are grouped together for the collision traversal.

If there are 32 or fewer colliders added to any particular CollisionTraverser, then this value has no meaning. It is only useful if there are many colliders, which may force the CollisionTraverser to make multiple passes through the data; in that case, it may be a useful optimization to group colliders that have similar bounding volumes together (by giving them similar sort values).

Return type

int

property default_collide_mask

Returns the default into_collide_mask assigned to new CollisionNodes.

Return type

CollideMask