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 More... | |
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. More... | |
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. More... | |
LVector3 | get_contact_normal (const NodePath &space) const |
Returns the surface normal of the "into" object at the contact position. More... | |
LPoint3 | get_contact_pos (const NodePath &space) const |
Returns the position of the "from" object at the instant that a collision is first detected. More... | |
const CollisionSolid * | get_from () const |
Returns the CollisionSolid pointer for the particular solid that triggered this collision. More... | |
CollisionNode * | get_from_node () const |
Returns the node that contains the CollisionSolid that triggered this collision. More... | |
NodePath | get_from_node_path () const |
Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggered this collision. More... | |
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. More... | |
const CollisionSolid * | get_into () const |
Returns the CollisionSolid pointer for the particular solid was collided into. More... | |
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. More... | |
PandaNode * | get_into_node () const |
Returns the node that contains the CollisionSolid that was collided into. More... | |
NodePath | get_into_node_path () const |
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. More... | |
const LMatrix4 & | get_inv_wrt_mat () const |
Returns the relative transform of the into node as seen from the from node. More... | |
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. More... | |
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. More... | |
LPoint3 | get_surface_point (const NodePath &space) const |
Returns the point, on the surface of the "into" object, at which a collision is detected. More... | |
PN_stdfloat | get_t () const |
returns time value for this collision relative to other CollisionEntries More... | |
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. More... | |
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.) More... | |
bool | has_contact_normal () const |
Returns true if the contact normal has been specified, false otherwise. More... | |
bool | has_contact_pos () const |
Returns true if the contact position has been specified, false otherwise. More... | |
bool | has_interior_point () const |
Returns true if the interior point has been specified, false otherwise. More... | |
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). More... | |
bool | has_surface_normal () const |
Returns true if the surface normal has been specified, false otherwise. More... | |
bool | has_surface_point () const |
Returns true if the surface point has been specified, false otherwise. More... | |
void | operator= (const CollisionEntry ©) |
void | output (ostream &out) const |
void | reset_collided () |
prepare for another collision test More... | |
void | set_contact_normal (const LVector3 &normal) |
Stores the surface normal of the "into" object at the contact pos. More... | |
void | set_contact_pos (const LPoint3 &pos) |
Stores the position of the "from" object at the instant at which the collision is first detected. More... | |
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. More... | |
void | set_surface_normal (const LVector3 &normal) |
Stores the surface normal of the "into" object at the point of the intersection. More... | |
void | set_surface_point (const LPoint3 &point) |
Stores the point, on the surface of the "into" object, at which a collision is detected. More... | |
void | set_t (PN_stdfloat t) |
Sets a time value for this collision relative to other CollisionEntries. More... | |
void | write (ostream &out, int indent_level=0) const |
![]() | |
TypedWritableReferenceCount (const TypedWritableReferenceCount ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
void | operator= (const TypedWritableReferenceCount ©) |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More... | |
string | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. More... | |
bool | encode_to_bam_stream (string &data, BamWriter *writer=NULL) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
virtual void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More... | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More... | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More... | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More... | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. More... | |
![]() | |
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 | PT (TypedWritableReferenceCount) decode_from_bam_stream(const string &data |
![]() | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. More... | |
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 () |
Friends | |
class | CollisionHandlerFluidPusher |
class | CollisionTraverser |
Additional Inherited Members | |
![]() | |
static BamReader * | reader = NULL) |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
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.
|
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().
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(), LPoint3f::zero(), and LVector3f::zero().
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(), LPoint3f::zero(), and LVector3f::zero().
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().
|
inline |
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
Definition at line 35 of file collisionEntry.I.
Referenced by CollisionHandlerFluidPusher::add_entry(), CollisionHandlerPhysical::add_entry(), and CollisionHandlerHighestEvent::add_entry().
|
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.
|
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 CollisionHandlerFluidPusher::add_entry(), CollisionHandlerPhysical::add_entry(), CollisionHandlerHighestEvent::add_entry(), and CollisionHandlerEvent::add_entry().
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().
|
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 CollisionHandlerFluidPusher::add_entry(), and CollisionHandlerPhysical::add_entry().
|
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.
|
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.
|
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().
|
inline |
Returns the relative transform of the into node as seen from the from node.
Definition at line 392 of file collisionEntry.I.
|
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 CollisionHandlerPhysical::add_entry(), CollisionHandlerHighestEvent::add_entry(), and get_interior_point().
|
inline |
returns time value for this collision relative to other CollisionEntries
Definition at line 145 of file collisionEntry.I.
|
inline |
Returns the relative transform of the from node as seen from the into node.
Definition at line 381 of file collisionEntry.I.
|
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.
|
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().
|
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().
|
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().
|
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 CollisionHandlerFluidPusher::add_entry(), and CollisionHandlerPhysical::add_entry().
|
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().
|
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(), and get_surface_point().
|
inline |
prepare for another collision test
Definition at line 168 of file collisionEntry.I.
|
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().
|
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().
|
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().
|
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().
|
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().
|
inline |
Sets a time value for this collision relative to other CollisionEntries.
Definition at line 133 of file collisionEntry.I.