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_inv_wrt_space() const | |
CPT (TransformState) get_wrt_prev_space() const | |
CPT (TransformState) get_wrt_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 |
CollisionNode * | get_from_node () const |
NodePath | get_from_node_path () const |
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 |
const ClipPlaneAttrib * | get_into_clip_planes () const |
PandaNode * | get_into_node () const |
NodePath | get_into_node_path () const |
const LMatrix4 & | get_inv_wrt_mat () const |
bool | get_respect_prev_transform () const |
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 |
virtual TypeHandle | get_type () const |
const LMatrix4 & | get_wrt_mat () const |
const LMatrix4 & | get_wrt_prev_mat () const |
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 (std::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) |
void | write (std::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. | |
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(). | |
vector_uchar | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. | |
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
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. | |
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. | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
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. | |
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. | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. | |
![]() | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
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. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
TypedObject & | operator= (const TypedObject ©)=default |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
![]() | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | ref () const |
Explicitly increments the reference count. | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
bool | unref_if_one () const |
Atomically decreases the reference count of this object if it is one. | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. | |
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(vector_uchar data |
![]() | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. | |
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. | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
Public Attributes | |
get_from | |
Returns the CollisionSolid pointer for the particular solid that triggered this collision. | |
get_from_node | |
Returns the node that contains the CollisionSolid that triggered this collision. | |
get_from_node_path | |
Returns the NodePath that represents the CollisionNode that contains the CollisionSolid that triggered this collision. | |
get_into | |
Returns the CollisionSolid pointer for the particular solid was collided into. | |
get_into_node | |
Returns the node that contains the CollisionSolid that was collided into. | |
get_into_node_path | |
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. | |
get_respect_prev_transform | |
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. | |
get_t | |
returns time value for this collision relative to other CollisionEntries | |
set_t | |
Sets a time value for this collision relative to other CollisionEntries. | |
![]() | |
static BamReader * | reader = nullptr) |
![]() | |
get_type | |
![]() | |
get_ref_count | |
Returns the current reference count. | |
Friends | |
class | CollisionHandlerFluidPusher |
class | CollisionTraverser |
Additional Inherited Members | |
![]() | |
static TypedWritable *const | Null = nullptr |
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 42 of file collisionEntry.h.
|
inline |
Definition at line 17 of file collisionEntry.I.
CollisionEntry::CollisionEntry | ( | const CollisionEntry & | copy | ) |
Definition at line 23 of file collisionEntry.cxx.
|
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 121 of file collisionEntry.I.
Referenced by CollisionHandlerFluidPusher::add_entry().
|
inlinevirtual |
Reimplemented from TypedWritableReferenceCount.
Definition at line 164 of file collisionEntry.h.
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 119 of file collisionEntry.cxx.
References NodePath::get_transform(), has_interior_point(), has_surface_normal(), and has_surface_point().
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 184 of file collisionEntry.cxx.
References NodePath::get_transform(), has_contact_normal(), and has_contact_pos().
|
inlinestatic |
Definition at line 153 of file collisionEntry.h.
LVector3 CollisionEntry::get_contact_normal | ( | const NodePath & | space | ) | const |
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 170 of file collisionEntry.cxx.
References NodePath::get_transform(), and has_contact_normal().
LPoint3 CollisionEntry::get_contact_pos | ( | const NodePath & | space | ) | const |
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 157 of file collisionEntry.cxx.
References NodePath::get_transform(), and has_contact_pos().
LPoint3 CollisionEntry::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.
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 103 of file collisionEntry.cxx.
References get_surface_point(), NodePath::get_transform(), and has_interior_point().
LVector3 CollisionEntry::get_surface_normal | ( | const NodePath & | space | ) | const |
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 86 of file collisionEntry.cxx.
References NodePath::get_transform(), and has_surface_normal().
Referenced by CollisionHandlerPhysical::add_entry().
LPoint3 CollisionEntry::get_surface_point | ( | const NodePath & | space | ) | const |
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 72 of file collisionEntry.cxx.
References NodePath::get_transform(), and has_surface_point().
Referenced by CollisionHandlerHighestEvent::add_entry(), CollisionHandlerPhysical::add_entry(), and get_interior_point().
|
inlinevirtual |
Reimplemented from TypedWritableReferenceCount.
Definition at line 161 of file collisionEntry.h.
|
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 256 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 246 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 211 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 39 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 201 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 191 of file collisionEntry.I.
Referenced by CollisionHandlerPhysical::add_entry(), get_all(), and get_surface_point().
|
inlinestatic |
Definition at line 156 of file collisionEntry.h.
void CollisionEntry::operator= | ( | const CollisionEntry & | copy | ) |
Definition at line 45 of file collisionEntry.cxx.
void CollisionEntry::output | ( | std::ostream & | out | ) | const |
Definition at line 211 of file collisionEntry.cxx.
|
inline |
prepare for another collision test
Definition at line 129 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 234 of file collisionEntry.I.
|
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 222 of file collisionEntry.I.
|
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 179 of file collisionEntry.I.
|
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 164 of file collisionEntry.I.
|
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 151 of file collisionEntry.I.
void CollisionEntry::write | ( | std::ostream & | out, |
int | indent_level = 0 ) const |
Definition at line 225 of file collisionEntry.cxx.
|
friend |
Definition at line 170 of file collisionEntry.h.
|
friend |
Definition at line 169 of file collisionEntry.h.
|
inline |
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
Definition at line 97 of file collisionEntry.h.
Referenced by CollisionHandlerFluidPusher::add_entry(), CollisionHandlerHighestEvent::add_entry(), and CollisionHandlerPhysical::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 99 of file collisionEntry.h.
|
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 101 of file collisionEntry.h.
Referenced by CollisionHandlerEvent::add_entry(), CollisionHandlerFluidPusher::add_entry(), CollisionHandlerHighestEvent::add_entry(), and CollisionHandlerPhysical::add_entry().
|
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 98 of file collisionEntry.h.
Referenced by CollisionHandlerFluidPusher::add_entry(), CollisionHandlerPhysical::add_entry(), PT(), PT(), PT(), PT(), PT(), PT(), and PT().
|
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 100 of file collisionEntry.h.
|
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 102 of file collisionEntry.h.
Referenced by CollisionHandlerEvent::add_entry().
|
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 105 of file collisionEntry.h.
|
inline |
returns time value for this collision relative to other CollisionEntries
Definition at line 104 of file collisionEntry.h.
|
inline |
Sets a time value for this collision relative to other CollisionEntries.
Definition at line 104 of file collisionEntry.h.