Panda3D
|
Defines a single collision event. More...
#include "collisionEntry.h"
Public Member Functions | |
CollisionEntry (const CollisionEntry ©) | |
bool | collided () const |
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 | |
CPT (TransformState) get_wrt_space() const | |
CPT (TransformState) get_inv_wrt_space() const | |
CPT (TransformState) get_wrt_prev_space() const | |
virtual TypeHandle | force_init_type () |
bool | get_all (const NodePath &space, LPoint3 &surface_point, LVector3 &surface_normal, LPoint3 &interior_point) const |
Simultaneously transforms the surface point, surface normal, and interior point of the collision into the indicated coordinate space. | |
bool | get_all_contact_info (const NodePath &space, LPoint3 &contact_pos, LVector3 &contact_normal) const |
Simultaneously transforms the contact position and contact normal of the collision into the indicated coordinate space. | |
LVector3 | get_contact_normal (const NodePath &space) const |
Returns the surface normal of the "into" object at the contact position. | |
LPoint3 | get_contact_pos (const NodePath &space) const |
Returns the position of the "from" object at the instant that a collision is first detected. | |
const CollisionSolid * | get_from () const |
Returns the CollisionSolid pointer for the particular solid that triggered this collision. | |
CollisionNode * | get_from_node () const |
Returns the node that contains the CollisionSolid that triggered this collision. | |
NodePath | get_from_node_path () const |
Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggered this collision. | |
LPoint3 | get_interior_point (const NodePath &space) const |
Returns the point, within the interior of the "into" object, which represents the depth to which the "from" object has penetrated. | |
const CollisionSolid * | get_into () const |
Returns the CollisionSolid pointer for the particular solid was collided into. | |
const ClipPlaneAttrib * | get_into_clip_planes () const |
Returns the ClipPlaneAttrib, if any, that is applied to the into_node_path, or NULL if there is no clip plane in effect. | |
PandaNode * | get_into_node () const |
Returns the node that contains the CollisionSolid that was collided into. | |
NodePath | get_into_node_path () const |
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. | |
const LMatrix4 & | get_inv_wrt_mat () const |
Returns the relative transform of the into node as seen from the from node. | |
bool | get_respect_prev_transform () const |
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. | |
LVector3 | get_surface_normal (const NodePath &space) const |
Returns the surface normal of the "into" object at the point at which a collision is detected. | |
LPoint3 | get_surface_point (const NodePath &space) const |
Returns the point, on the surface of the "into" object, at which a collision is detected. | |
PN_stdfloat | get_t () const |
returns time value for this collision relative to other CollisionEntries | |
virtual TypeHandle | get_type () const |
const LMatrix4 & | get_wrt_mat () const |
Returns the relative transform of the from node as seen from the into node. | |
const LMatrix4 & | get_wrt_prev_mat () const |
Returns the relative transform of the from node as seen from the into node, as of the previous frame (according to set_prev_transform(), set_fluid_pos(), etc.) | |
bool | has_contact_normal () const |
Returns true if the contact normal has been specified, false otherwise. | |
bool | has_contact_pos () const |
Returns true if the contact position has been specified, false otherwise. | |
bool | has_interior_point () const |
Returns true if the interior point has been specified, false otherwise. | |
bool | has_into () const |
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). | |
bool | has_surface_normal () const |
Returns true if the surface normal has been specified, false otherwise. | |
bool | has_surface_point () const |
Returns true if the surface point has been specified, false otherwise. | |
void | operator= (const CollisionEntry ©) |
void | output (ostream &out) const |
void | reset_collided () |
prepare for another collision test | |
void | set_contact_normal (const LVector3 &normal) |
Stores the surface normal of the "into" object at the contact pos. | |
void | set_contact_pos (const LPoint3 &pos) |
Stores the position of the "from" object at the instant at which the collision is first detected. | |
void | set_interior_point (const LPoint3 &point) |
Stores the point, within the interior of the "into" object, which represents the depth to which the "from" object has penetrated. | |
void | set_surface_normal (const LVector3 &normal) |
Stores the surface normal of the "into" object at the point of the intersection. | |
void | set_surface_point (const LPoint3 &point) |
Stores the point, on the surface of the "into" object, at which a collision is detected. | |
void | set_t (PN_stdfloat t) |
Sets a time value for this collision relative to other CollisionEntries. | |
void | write (ostream &out, int indent_level=0) const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Friends | |
class | CollisionHandlerFluidPusher |
class | CollisionTraverser |
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.
Definition at line 46 of file collisionEntry.h.
bool CollisionEntry::collided | ( | ) | const [inline] |
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
Definition at line 158 of file collisionEntry.I.
Referenced by CollisionHandlerFluidPusher::add_entry(), and CollisionHandlerFluidPusher::handle_entries().
bool CollisionEntry::get_all | ( | const NodePath & | space, |
LPoint3 & | surface_point, | ||
LVector3 & | surface_normal, | ||
LPoint3 & | interior_point | ||
) | const |
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.
Definition at line 137 of file collisionEntry.cxx.
References NodePath::get_transform(), has_interior_point(), has_surface_normal(), has_surface_point(), LVector3f::zero(), and LPoint3f::zero().
Referenced by CollisionHandlerPusher::handle_entries().
bool CollisionEntry::get_all_contact_info | ( | const NodePath & | space, |
LPoint3 & | contact_pos, | ||
LVector3 & | contact_normal | ||
) | const |
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.
Definition at line 210 of file collisionEntry.cxx.
References NodePath::get_transform(), has_contact_normal(), has_contact_pos(), LVector3f::zero(), and LPoint3f::zero().
Referenced by CollisionHandlerFluidPusher::handle_entries().
Returns the surface normal of the "into" object at the contact position.
The normal will be converted into whichever coordinate space the caller specifies.
Definition at line 193 of file collisionEntry.cxx.
References NodePath::get_transform(), has_contact_normal(), and LVector3f::zero().
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.
Definition at line 177 of file collisionEntry.cxx.
References NodePath::get_transform(), has_contact_pos(), and LPoint3f::zero().
const CollisionSolid * CollisionEntry::get_from | ( | ) | const [inline] |
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
Definition at line 35 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), CollisionHandlerHighestEvent::add_entry(), CollisionHandlerFluidPusher::add_entry(), CollisionHandlerFluidPusher::handle_entries(), and CollisionHandlerEvent::throw_event_pattern().
CollisionNode * CollisionEntry::get_from_node | ( | ) | const [inline] |
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().
Definition at line 77 of file collisionEntry.I.
Referenced by CollisionHandlerEvent::throw_event_pattern().
NodePath CollisionEntry::get_from_node_path | ( | ) | const [inline] |
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().
Definition at line 106 of file collisionEntry.I.
Referenced by CollisionHandlerHighestEvent::add_entry(), CollisionHandlerPhysical::add_entry(), CollisionHandlerEvent::add_entry(), CollisionHandlerFluidPusher::add_entry(), CollisionHandlerFluidPusher::handle_entries(), CollisionHandlerPusher::handle_entries(), CollisionHandlerFloor::handle_entries(), CollisionHandlerEvent::SortEntries::operator()(), and CollisionHandlerEvent::throw_event_pattern().
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.
Definition at line 118 of file collisionEntry.cxx.
References get_surface_point(), NodePath::get_transform(), and has_interior_point().
const CollisionSolid * CollisionEntry::get_into | ( | ) | const [inline] |
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().
Definition at line 64 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), CollisionHandlerFluidPusher::add_entry(), CollisionHandlerPusher::handle_entries(), and CollisionHandlerEvent::throw_event_pattern().
const ClipPlaneAttrib * CollisionEntry::get_into_clip_planes | ( | ) | const [inline] |
Returns the ClipPlaneAttrib, if any, that is applied to the into_node_path, or NULL if there is no clip plane in effect.
Definition at line 417 of file collisionEntry.I.
PandaNode * CollisionEntry::get_into_node | ( | ) | const [inline] |
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().
Definition at line 92 of file collisionEntry.I.
Referenced by CollisionHandlerEvent::throw_event_pattern().
NodePath CollisionEntry::get_into_node_path | ( | ) | const [inline] |
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.
Definition at line 122 of file collisionEntry.I.
Referenced by CollisionHandlerEvent::add_entry(), CollisionHandlerFluidPusher::handle_entries(), CollisionHandlerPusher::handle_entries(), CollisionHandlerEvent::SortEntries::operator()(), and CollisionHandlerEvent::throw_event_pattern().
const LMatrix4 & CollisionEntry::get_inv_wrt_mat | ( | ) | const [inline] |
Returns the relative transform of the into node as seen from the from node.
Definition at line 392 of file collisionEntry.I.
bool CollisionEntry::get_respect_prev_transform | ( | ) | const [inline] |
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.
Definition at line 181 of file collisionEntry.I.
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.
Definition at line 97 of file collisionEntry.cxx.
References NodePath::get_transform(), has_surface_normal(), and LVector3f::zero().
Referenced by CollisionHandlerPhysical::add_entry().
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.
Definition at line 81 of file collisionEntry.cxx.
References NodePath::get_transform(), has_surface_point(), and LPoint3f::zero().
Referenced by CollisionHandlerHighestEvent::add_entry(), CollisionHandlerPhysical::add_entry(), get_interior_point(), and CollisionHandlerFloor::handle_entries().
PN_stdfloat CollisionEntry::get_t | ( | ) | const [inline] |
returns time value for this collision relative to other CollisionEntries
Definition at line 145 of file collisionEntry.I.
Referenced by CollisionHandlerFluidPusher::handle_entries().
const LMatrix4 & CollisionEntry::get_wrt_mat | ( | ) | const [inline] |
Returns the relative transform of the from node as seen from the into node.
Definition at line 381 of file collisionEntry.I.
const LMatrix4 & CollisionEntry::get_wrt_prev_mat | ( | ) | const [inline] |
Returns the relative transform of the from node as seen from the into node, as of the previous frame (according to set_prev_transform(), set_fluid_pos(), etc.)
Definition at line 405 of file collisionEntry.I.
bool CollisionEntry::has_contact_normal | ( | ) | const [inline] |
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.
Definition at line 331 of file collisionEntry.I.
Referenced by get_all_contact_info(), and get_contact_normal().
bool CollisionEntry::has_contact_pos | ( | ) | const [inline] |
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.
Definition at line 318 of file collisionEntry.I.
Referenced by get_all_contact_info(), and get_contact_pos().
bool CollisionEntry::has_interior_point | ( | ) | const [inline] |
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.
Definition at line 273 of file collisionEntry.I.
Referenced by get_all(), and get_interior_point().
bool CollisionEntry::has_into | ( | ) | const [inline] |
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.
Definition at line 50 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), CollisionHandlerFluidPusher::add_entry(), and CollisionHandlerEvent::throw_event_pattern().
bool CollisionEntry::has_surface_normal | ( | ) | const [inline] |
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.
Definition at line 260 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), get_all(), and get_surface_normal().
bool CollisionEntry::has_surface_point | ( | ) | const [inline] |
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.
Definition at line 247 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), get_all(), get_surface_point(), and CollisionHandlerFloor::handle_entries().
void CollisionEntry::reset_collided | ( | ) | [inline] |
prepare for another collision test
Definition at line 168 of file collisionEntry.I.
Referenced by CollisionHandlerFluidPusher::handle_entries().
void CollisionEntry::set_contact_normal | ( | const LVector3 & | normal | ) | [inline] |
Stores the surface normal of the "into" object at the contact pos.
This normal is specified in the coordinate space of the "into" object.
Definition at line 303 of file collisionEntry.I.
References LVecBase3f::is_nan().
void CollisionEntry::set_contact_pos | ( | const LPoint3 & | pos | ) | [inline] |
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.
Definition at line 287 of file collisionEntry.I.
References LVecBase3f::is_nan().
void CollisionEntry::set_interior_point | ( | const LPoint3 & | point | ) | [inline] |
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.
Definition at line 232 of file collisionEntry.I.
References LVecBase3f::is_nan().
void CollisionEntry::set_surface_normal | ( | const LVector3 & | normal | ) | [inline] |
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.
Definition at line 212 of file collisionEntry.I.
References LVecBase3f::is_nan().
void CollisionEntry::set_surface_point | ( | const LPoint3 & | point | ) | [inline] |
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.
Definition at line 196 of file collisionEntry.I.
References LVecBase3f::is_nan().
void CollisionEntry::set_t | ( | PN_stdfloat | t | ) | [inline] |
Sets a time value for this collision relative to other CollisionEntries.
Definition at line 133 of file collisionEntry.I.