17 INLINE CollisionEntry::
41 return (_into !=
nullptr);
61 get_from_node()
const {
73 get_into_node()
const {
83 get_from_node_path()
const {
84 return _from_node_path;
95 get_into_node_path()
const {
96 return _into_node_path;
103 set_t(PN_stdfloat t) {
111 INLINE PN_stdfloat CollisionEntry::
123 return ((0.f <= _t) && (_t <= 1.f));
139 INLINE
bool CollisionEntry::
140 get_respect_prev_transform()
const {
141 return (_flags & F_respect_prev_transform) != 0;
153 nassertv(!point.is_nan());
154 _surface_point = point;
155 _flags |= F_has_surface_point;
166 nassertv(!normal.is_nan());
167 _surface_normal = normal;
168 _flags |= F_has_surface_normal;
181 nassertv(!point.is_nan());
182 _interior_point = point;
183 _flags |= F_has_interior_point;
193 return (_flags & F_has_surface_point) != 0;
203 return (_flags & F_has_surface_normal) != 0;
213 return (_flags & F_has_interior_point) != 0;
224 nassertv(!pos.is_nan());
226 _flags |= F_has_contact_pos;
236 nassertv(!normal.is_nan());
237 _contact_normal = normal;
238 _flags |= F_has_contact_normal;
248 return (_flags & F_has_contact_pos) != 0;
258 return (_flags & F_has_contact_normal) != 0;
265 get_wrt_space()
const {
273 get_inv_wrt_space()
const {
283 get_wrt_prev_space()
const {
287 return get_wrt_space();
294 INLINE
const LMatrix4 &CollisionEntry::
295 get_wrt_mat()
const {
296 return get_wrt_space()->get_mat();
302 INLINE
const LMatrix4 &CollisionEntry::
303 get_inv_wrt_mat()
const {
304 return get_inv_wrt_space()->get_mat();
312 INLINE
const LMatrix4 &CollisionEntry::
313 get_wrt_prev_mat()
const {
314 return get_wrt_prev_space()->get_mat();
322 get_into_clip_planes()
const {
323 if ((_flags & F_checked_clip_planes) == 0) {
326 return _into_clip_planes;
335 INLINE
void CollisionEntry::
339 #ifdef DO_COLLISION_RECORDING 340 if (trav->has_recorder()) {
341 if (result !=
nullptr) {
342 trav->get_recorder()->collision_tested(*result,
true);
344 trav->get_recorder()->collision_tested(*
this,
false);
347 #endif // DO_COLLISION_RECORDING 354 if (record->wants_all_potential_collidees() && result ==
nullptr) {
356 result->reset_collided();
358 if (result !=
nullptr) {
359 record->add_entry(result);
363 INLINE std::ostream &
bool has_surface_point() const
Returns true if the surface point has been specified, false otherwise.
A basic node of the scene graph or data graph.
The abstract interface to a number of classes that decide what to do when a collision is detected.
The abstract base class for all things that can collide with other things in the world,...
bool has_contact_normal() const
Returns true if the contact normal has been specified, false otherwise.
void set_contact_normal(const LVector3 &normal)
Stores the surface normal of the "into" object at the contact pos.
CPT(TransformState) CollisionEntry
Returns the relative transform of the from node as seen from the into node.
bool collided() const
returns true if this represents an actual collision as opposed to a potential collision,...
This functions similarly to a LightAttrib.
void set_interior_point(const LPoint3 &point)
Stores the point, within the interior of the "into" object, which represents the depth to which the "...
bool has_into() const
Returns true if the "into" solid is, in fact, a CollisionSolid, and its pointer is known (in which ca...
bool has_surface_normal() const
Returns true if the surface normal has been specified, false otherwise.
set_t
Sets a time value for this collision relative to other CollisionEntries.
get_respect_prev_transform
Returns true if the collision was detected by a CollisionTraverser whose respect_prev_transform flag ...
Defines a single collision event.
bool has_contact_pos() const
Returns true if the contact position has been specified, false otherwise.
void set_contact_pos(const LPoint3 &pos)
Stores the position of the "from" object at the instant at which the collision is first detected.
get_into
Returns the CollisionSolid pointer for the particular solid was collided into.
get_from
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
A node in the scene graph that can hold any number of CollisionSolids.
bool has_interior_point() const
Returns true if the interior point has been specified, false otherwise.
This class manages the traversal through the scene graph to detect collisions.
const TransformState * get_transform(Thread *current_thread=Thread::get_current_thread()) const
Returns the complete transform object set on this node.
void set_surface_point(const LPoint3 &point)
Stores the point, on the surface of the "into" object, at which a collision is detected.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void set_surface_normal(const LVector3 &normal)
Stores the surface normal of the "into" object at the point of the intersection.
void reset_collided()
prepare for another collision test
const TransformState * get_prev_transform(Thread *current_thread=Thread::get_current_thread()) const
Returns the transform that has been set as this node's "previous" position.