15 #include "collisionEntry.h" 30 _from_node(copy._from_node),
31 _into_node(copy._into_node),
32 _from_node_path(copy._from_node_path),
33 _into_node_path(copy._into_node_path),
34 _into_clip_planes(copy._into_clip_planes),
37 _surface_point(copy._surface_point),
38 _surface_normal(copy._surface_normal),
39 _interior_point(copy._interior_point),
40 _contact_pos(copy._contact_pos),
41 _contact_normal(copy._contact_normal)
54 _from_node = copy._from_node;
55 _into_node = copy._into_node;
56 _from_node_path = copy._from_node_path;
57 _into_node_path = copy._into_node_path;
58 _into_clip_planes = copy._into_clip_planes;
61 _surface_point = copy._surface_point;
62 _surface_normal = copy._surface_normal;
63 _interior_point = copy._interior_point;
64 _contact_pos = copy._contact_pos;
65 _contact_normal = copy._contact_normal;
83 CPT(TransformState) transform = _into_node_path.
get_transform(space);
84 return _surface_point * transform->get_mat();
99 CPT(TransformState) transform = _into_node_path.
get_transform(space);
100 return _surface_normal * transform->get_mat();
122 CPT(TransformState) transform = _into_node_path.
get_transform(space);
123 return _interior_point * transform->get_mat();
139 CPT(TransformState) transform = _into_node_path.
get_transform(space);
140 const LMatrix4 &mat = transform->get_mat();
147 surface_point = _surface_point * mat;
154 surface_normal = _surface_normal * mat;
158 interior_point = surface_point;
161 interior_point = _interior_point * mat;
179 CPT(TransformState) transform = _into_node_path.
get_transform(space);
180 return _contact_pos * transform->get_mat();
195 CPT(TransformState) transform = _into_node_path.
get_transform(space);
196 return _contact_normal * transform->get_mat();
212 CPT(TransformState) transform = _into_node_path.
get_transform(space);
213 const LMatrix4 &mat = transform->get_mat();
220 contact_pos = _contact_pos * mat;
227 contact_normal = _contact_normal * mat;
238 void CollisionEntry::
239 output(ostream &out)
const {
240 out << _from_node_path;
242 out <<
" into " << _into_node_path;
254 void CollisionEntry::
255 write(ostream &out,
int indent_level)
const {
256 indent(out, indent_level)
257 <<
"CollisionEntry:\n";
259 indent(out, indent_level + 2)
260 <<
"from " << _from_node_path <<
"\n";
263 indent(out, indent_level + 2)
264 <<
"into " << _into_node_path;
277 indent(out, indent_level + 2)
281 indent(out, indent_level + 2)
285 indent(out, indent_level + 2)
291 indent(out, indent_level + 2)
301 void CollisionEntry::
302 check_clip_planes() {
303 _into_clip_planes = DCAST(
ClipPlaneAttrib, _into_node_path.get_net_state()->
get_attrib(ClipPlaneAttrib::get_class_slot()));
304 _flags |= F_checked_clip_planes;
bool has_surface_point() const
Returns true if the surface point has been specified, false otherwise.
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...
LPoint3 get_surface_point(const NodePath &space) const
Returns the point, on the surface of the "into" object, at which a collision is detected.
LPoint3 get_contact_pos(const NodePath &space) const
Returns the position of the "from" object at the instant that a collision is first detected...
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...
bool is_empty() const
Returns true if the NodePath contains no nodes.
bool has_contact_normal() const
Returns true if the contact normal has been specified, false otherwise.
static const LPoint3f & zero()
Returns a zero-length point.
static const LVector3f & zero()
Returns a zero-length vector.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This functions similarly to a LightAttrib.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
LVector3 get_contact_normal(const NodePath &space) const
Returns the surface normal of the "into" object at the contact position.
bool has_surface_normal() const
Returns true if the surface normal has been specified, false otherwise.
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...
const RenderAttrib * get_attrib(TypeHandle type) const
Returns the render attribute of the indicated type, if it is defined on the node, or NULL if it is no...
This is a 4-by-4 transform matrix.
Defines a single collision event.
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 ...
bool has_contact_pos() const
Returns true if the contact position has been specified, false otherwise.
PandaNode * node() const
Returns the referenced node of the path.
bool has_interior_point() const
Returns true if the interior point has been specified, false otherwise.
TypeHandle is the identifier used to differentiate C++ class types.
const TransformState * get_transform(Thread *current_thread=Thread::get_current_thread()) const
Returns the complete transform object set on this node.
bool get_respect_prev_transform() const
Returns true if the collision was detected by a CollisionTraverser whose respect_prev_transform flag ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void list_tags(ostream &out, const string &separator="\) const
Writes a list of all the tag keys assigned to the node to the indicated stream.