Panda3D
|
The abstract base class for a number of CollisionHandlers that have some physical effect on their moving bodies: they need to update the nodes' positions based on the effects of the collision. More...
#include "collisionHandlerPhysical.h"
Public Member Functions | |
void | add_collider (const NodePath &collider, const NodePath &target) |
Adds a new collider to the list with a NodePath that will be updated with the collider's new position, or updates the existing collider with a new NodePath object. More... | |
void | add_collider (const NodePath &collider, const NodePath &target, DriveInterface *drive_interface) |
Adds a new collider to the list with a NodePath that will be updated with the collider's new position, or updates the existing collider with a new NodePath object. More... | |
virtual void | add_entry (CollisionEntry *entry) |
Called between a begin_group() . More... | |
virtual void | begin_group () |
Will be called by the CollisionTraverser before a new traversal is begun. More... | |
void | clear_center () |
Clears the center NodePath specified with set_center. More... | |
void | clear_colliders () |
Completely empties the list of colliders this handler knows about. More... | |
virtual bool | end_group () |
Called by the CollisionTraverser at the completion of all collision detections for this traversal. More... | |
virtual TypeHandle | force_init_type () |
const NodePath & | get_center () const |
Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified. More... | |
virtual TypeHandle | get_type () const |
bool | has_center () const |
Returns true if a NodePath has been specified with set_center(), false otherwise. More... | |
bool | has_collider (const NodePath &collider) const |
Returns true if the handler knows about the indicated collider, false otherwise. More... | |
bool | has_contact () const |
Did the handler make any contacts with anything on the last collision pass? Depending on how your world is setup, this can be used to tell if the handler is out of the world (i.e. More... | |
bool | remove_collider (const NodePath &collider) |
Removes the collider from the list of colliders that this handler knows about. More... | |
void | set_center (const NodePath ¢er) |
Specifies an arbitrary NodePath that the handler is always considered to be facing. More... | |
![]() | |
CollisionHandlerEvent () | |
The default CollisionHandlerEvent will throw no events. More... | |
void | add_again_pattern (const string &again_pattern) |
Adds the pattern string that indicates how the event names are generated when a collision between two particular nodes is *still* detected. More... | |
void | add_in_pattern (const string &in_pattern) |
Adds a pattern string to the list of events that will be generated in response to a collision. More... | |
void | add_out_pattern (const string &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. More... | |
void | clear () |
Empties the list of elements that all colliders are known to be colliding with. More... | |
void | clear_again_patterns () |
Removes all of the previously-added in patterns. More... | |
void | clear_in_patterns () |
Removes all of the previously-added in patterns. More... | |
void | clear_out_patterns () |
Removes all of the previously-added in patterns. More... | |
void | flush () |
Same as clear() except "out" events are thrown. More... | |
string | get_again_pattern (int n) const |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. More... | |
string | get_in_pattern (int n) const |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. More... | |
int | get_num_again_patterns () const |
Returns the number of in pattern strings that have been added. More... | |
int | get_num_in_patterns () const |
Returns the number of in pattern strings that have been added. More... | |
int | get_num_out_patterns () const |
Returns the number of in pattern strings that have been added. More... | |
string | get_out_pattern (int n) const |
Returns the nth pattern string that indicates how the event names are generated for each collision detected. More... | |
MAKE_SEQ (get_in_patterns, get_num_in_patterns, get_in_pattern) | |
MAKE_SEQ (get_again_patterns, get_num_again_patterns, get_again_pattern) | |
MAKE_SEQ (get_out_patterns, get_num_out_patterns, get_out_pattern) | |
void | set_again_pattern (const string &again_pattern) |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. More... | |
void | set_in_pattern (const string &in_pattern) |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. More... | |
void | set_out_pattern (const string &out_pattern) |
This method is deprecated; it completely replaces all the in patterns that have previously been set with the indicated pattern. More... | |
![]() | |
void | set_root (const NodePath &root) |
Sets the root of the collision traversal. More... | |
bool | wants_all_potential_collidees () const |
Returns true if handler wants to know about all solids that are within the collider's bounding volume. More... | |
![]() | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
The abstract base class for a number of CollisionHandlers that have some physical effect on their moving bodies: they need to update the nodes' positions based on the effects of the collision.
Definition at line 34 of file collisionHandlerPhysical.h.
Adds a new collider to the list with a NodePath that will be updated with the collider's new position, or updates the existing collider with a new NodePath object.
Definition at line 115 of file collisionHandlerPhysical.cxx.
References PandaNode::is_collision_node(), NodePath::is_empty(), and NodePath::node().
Referenced by end_group().
void CollisionHandlerPhysical::add_collider | ( | const NodePath & | collider, |
const NodePath & | target, | ||
DriveInterface * | drive_interface | ||
) |
Adds a new collider to the list with a NodePath that will be updated with the collider's new position, or updates the existing collider with a new NodePath object.
The indicated DriveInterface will also be updated with the target's new transform each frame. This method should be used when the target is directly controlled by a DriveInterface.
Definition at line 135 of file collisionHandlerPhysical.cxx.
References PandaNode::is_collision_node(), NodePath::is_empty(), NodePath::node(), and remove_collider().
|
virtual |
Called between a begin_group() .
. end_group() sequence for each collision that is detected.
Reimplemented from CollisionHandlerEvent.
Reimplemented in CollisionHandlerFluidPusher.
Definition at line 64 of file collisionHandlerPhysical.cxx.
References CollisionHandlerEvent::add_entry(), end_group(), CollisionEntry::get_from(), CollisionEntry::get_from_node_path(), CollisionEntry::get_into(), CollisionEntry::get_surface_normal(), CollisionEntry::get_surface_point(), has_center(), CollisionEntry::has_into(), CollisionEntry::has_surface_normal(), CollisionEntry::has_surface_point(), and CollisionSolid::is_tangible().
Referenced by begin_group().
|
virtual |
Will be called by the CollisionTraverser before a new traversal is begun.
It instructs the handler to reset itself in preparation for a number of CollisionEntries to be sent.
Reimplemented from CollisionHandlerEvent.
Definition at line 51 of file collisionHandlerPhysical.cxx.
References add_entry(), and CollisionHandlerEvent::begin_group().
|
inline |
Clears the center NodePath specified with set_center.
Definition at line 36 of file collisionHandlerPhysical.I.
References get_center().
Referenced by set_center().
void CollisionHandlerPhysical::clear_colliders | ( | ) |
Completely empties the list of colliders this handler knows about.
Definition at line 177 of file collisionHandlerPhysical.cxx.
References NodePath::is_empty().
Referenced by has_collider().
|
virtual |
Called by the CollisionTraverser at the completion of all collision detections for this traversal.
It should do whatever finalization is required for the handler.
Reimplemented from CollisionHandlerEvent.
Definition at line 99 of file collisionHandlerPhysical.cxx.
References add_collider(), and CollisionHandlerEvent::end_group().
Referenced by add_entry().
|
inline |
Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified.
Definition at line 47 of file collisionHandlerPhysical.I.
References has_center().
Referenced by clear_center().
|
inline |
Returns true if a NodePath has been specified with set_center(), false otherwise.
Definition at line 58 of file collisionHandlerPhysical.I.
References has_contact(), and NodePath::is_empty().
Referenced by add_entry(), and get_center().
bool CollisionHandlerPhysical::has_collider | ( | const NodePath & | collider | ) | const |
Returns true if the handler knows about the indicated collider, false otherwise.
Definition at line 165 of file collisionHandlerPhysical.cxx.
References clear_colliders().
Referenced by remove_collider().
|
inline |
Did the handler make any contacts with anything on the last collision pass? Depending on how your world is setup, this can be used to tell if the handler is out of the world (i.e.
out of bounds). That is the original use of this call.
Definition at line 72 of file collisionHandlerPhysical.I.
Referenced by has_center().
bool CollisionHandlerPhysical::remove_collider | ( | const NodePath & | collider | ) |
Removes the collider from the list of colliders that this handler knows about.
Definition at line 149 of file collisionHandlerPhysical.cxx.
References has_collider().
Referenced by add_collider().
|
inline |
Specifies an arbitrary NodePath that the handler is always considered to be facing.
It does not detect collisions with surfaces that appear to be facing away from this NodePath. This works best when the collision surfaces in question are polygons.
Definition at line 26 of file collisionHandlerPhysical.I.
References clear_center().