CollisionHandlerEvent
from panda3d.core import CollisionHandlerEvent
- class CollisionHandlerEvent
Bases:
CollisionHandler
A specialized kind of CollisionHandler that throws an event for each collision detected. The event thrown may be based on the name of the moving object or the struck object, or both. The first parameter of the event will be a pointer to the CollisionEntry that triggered it.
Inheritance diagram
- __init__(*args, **kwargs)
- addAgainPattern()
C++ Interface: add_again_pattern(const CollisionHandlerEvent self, str again_pattern)
- /**
Adds the pattern string that indicates how the event names are generated
when a collision between two particular nodes is still detected. This
event is thrown each consecutive time a collision between two particular
nodes is detected, starting with the second time.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- addInPattern()
C++ Interface: add_in_pattern(const CollisionHandlerEvent self, str in_pattern)
- /**
Adds a pattern string to the list of events that will be generated in
response to a collision. The pattern string describes how the event name
will be composed. It is a string that may contain any of the following:
%fn - the name of the “from” object’s node %in - the name of the “into”
object’s node %fs - ‘t’ if “from” is tangible, ‘i’ if intangible %is -
‘t’ if “into” is tangible, ‘i’ if intangible %ig - ‘c’ if the collision is
into a CollisionNode, ‘g’ if it is a geom.
%(tag)fh - generate event only if “from” node has the indicated net tag.
%(tag)fx - generate event only if “from” node does not have the indicated
net tag. %(tag)ih - generate event only if “into” node has the indicated
net tag. %(tag)ix - generate event only if “into” node does not have the
indicated net tag. %(tag)ft - the indicated net tag value of the “from”
node. %(tag)it - the indicated net tag value of the “into” node.
Parentheses in the above are literal and should be included in the actual
pattern.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- addOutPattern()
C++ Interface: add_out_pattern(const CollisionHandlerEvent self, str out_pattern)
- /**
Adds the pattern string that indicates how the event names are generated
when a collision between two particular nodes is no longer detected.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- add_again_pattern()
C++ Interface: add_again_pattern(const CollisionHandlerEvent self, str again_pattern)
- /**
Adds the pattern string that indicates how the event names are generated
when a collision between two particular nodes is still detected. This
event is thrown each consecutive time a collision between two particular
nodes is detected, starting with the second time.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- add_in_pattern()
C++ Interface: add_in_pattern(const CollisionHandlerEvent self, str in_pattern)
- /**
Adds a pattern string to the list of events that will be generated in
response to a collision. The pattern string describes how the event name
will be composed. It is a string that may contain any of the following:
%fn - the name of the “from” object’s node %in - the name of the “into”
object’s node %fs - ‘t’ if “from” is tangible, ‘i’ if intangible %is -
‘t’ if “into” is tangible, ‘i’ if intangible %ig - ‘c’ if the collision is
into a CollisionNode, ‘g’ if it is a geom.
%(tag)fh - generate event only if “from” node has the indicated net tag.
%(tag)fx - generate event only if “from” node does not have the indicated
net tag. %(tag)ih - generate event only if “into” node has the indicated
net tag. %(tag)ix - generate event only if “into” node does not have the
indicated net tag. %(tag)ft - the indicated net tag value of the “from”
node. %(tag)it - the indicated net tag value of the “into” node.
Parentheses in the above are literal and should be included in the actual
pattern.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- add_out_pattern()
C++ Interface: add_out_pattern(const CollisionHandlerEvent self, str out_pattern)
- /**
Adds the pattern string that indicates how the event names are generated
when a collision between two particular nodes is no longer detected.
In general, the in_pattern event is thrown on the first detection of a
collision between two particular nodes. In subsequent passes, as long as a
collision between those two nodes continues to be detected each frame, the
again_pattern is thrown. The first frame in which the collision is no
longer detected, the out_pattern event is thrown.
*/
- again_patterns
- clear()
C++ Interface: clear(const CollisionHandlerEvent self)
- /**
Empties the list of elements that all colliders are known to be colliding
with. No “out” events will be thrown; if the same collision is detected
next frame, a new “in” event will be thrown for each collision.
This can be called each frame to defeat the persistent “in” event
mechanism, which prevents the same “in” event from being thrown repeatedly.
However, also see add_again_pattern(), which can be used to set the event
that is thrown when a collision is detected for two or more consecutive
frames.
*/
- clearAgainPatterns()
C++ Interface: clear_again_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_again_pattern.
*/
- clearInPatterns()
C++ Interface: clear_in_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_in_pattern.
*/
- clearOutPatterns()
C++ Interface: clear_out_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_out_pattern.
*/
- clear_again_patterns()
C++ Interface: clear_again_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_again_pattern.
*/
- clear_in_patterns()
C++ Interface: clear_in_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_in_pattern.
*/
- clear_out_patterns()
C++ Interface: clear_out_patterns(const CollisionHandlerEvent self)
- /**
Removes all of the previously-added in patterns. See add_out_pattern.
*/
- flush()
C++ Interface: flush(const CollisionHandlerEvent self)
- /**
Same as clear() except “out” events are thrown.
*/
- getAgainPattern()
C++ Interface: get_again_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_again_pattern().
*/
- getAgainPatterns()
- getClassType()
C++ Interface: get_class_type()
- getInPattern()
C++ Interface: get_in_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_in_pattern().
*/
- getInPatterns()
- getNumAgainPatterns()
C++ Interface: get_num_again_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- getNumInPatterns()
C++ Interface: get_num_in_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- getNumOutPatterns()
C++ Interface: get_num_out_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- getOutPattern()
C++ Interface: get_out_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_out_pattern().
*/
- getOutPatterns()
- get_again_pattern()
C++ Interface: get_again_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_again_pattern().
*/
- get_again_patterns()
- get_class_type()
C++ Interface: get_class_type()
- get_in_pattern()
C++ Interface: get_in_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_in_pattern().
*/
- get_in_patterns()
- get_num_again_patterns()
C++ Interface: get_num_again_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- get_num_in_patterns()
C++ Interface: get_num_in_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- get_num_out_patterns()
C++ Interface: get_num_out_patterns(CollisionHandlerEvent self)
- /**
Returns the number of in pattern strings that have been added.
*/
- get_out_pattern()
C++ Interface: get_out_pattern(CollisionHandlerEvent self, int n)
- /**
Returns the nth pattern string that indicates how the event names are
generated for each collision detected. See add_out_pattern().
*/
- get_out_patterns()
- in_patterns
- out_patterns
- readDatagram()
C++ Interface: read_datagram(const CollisionHandlerEvent self, DatagramIterator source)
- /**
Restores the object state from the given datagram, previously obtained using
__getstate__.
*/
- read_datagram()
C++ Interface: read_datagram(const CollisionHandlerEvent self, DatagramIterator source)
- /**
Restores the object state from the given datagram, previously obtained using
__getstate__.
*/
- setAgainPattern()
C++ Interface: set_again_pattern(const CollisionHandlerEvent self, str again_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_again_pattern() instead.
*/
- setInPattern()
C++ Interface: set_in_pattern(const CollisionHandlerEvent self, str in_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_in_pattern() instead.
*/
- setOutPattern()
C++ Interface: set_out_pattern(const CollisionHandlerEvent self, str out_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_out_pattern() instead.
*/
- set_again_pattern()
C++ Interface: set_again_pattern(const CollisionHandlerEvent self, str again_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_again_pattern() instead.
*/
- set_in_pattern()
C++ Interface: set_in_pattern(const CollisionHandlerEvent self, str in_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_in_pattern() instead.
*/
- set_out_pattern()
C++ Interface: set_out_pattern(const CollisionHandlerEvent self, str out_pattern)
- /**
This method is deprecated; it completely replaces all the in patterns that
have previously been set with the indicated pattern.
@deprecated Use add_out_pattern() instead.
*/