27 _from_node(copy._from_node),
28 _into_node(copy._into_node),
29 _from_node_path(copy._from_node_path),
30 _into_node_path(copy._into_node_path),
31 _into_clip_planes(copy._into_clip_planes),
34 _surface_point(copy._surface_point),
35 _surface_normal(copy._surface_normal),
36 _interior_point(copy._interior_point),
37 _contact_pos(copy._contact_pos),
38 _contact_normal(copy._contact_normal)
49 _from_node = copy._from_node;
50 _into_node = copy._into_node;
51 _from_node_path = copy._from_node_path;
52 _into_node_path = copy._into_node_path;
53 _into_clip_planes = copy._into_clip_planes;
56 _surface_point = copy._surface_point;
57 _surface_normal = copy._surface_normal;
58 _interior_point = copy._interior_point;
59 _contact_pos = copy._contact_pos;
60 _contact_normal = copy._contact_normal;
76 return _surface_point * transform->get_mat();
90 return _surface_normal * transform->get_mat();
109 return _interior_point * transform->get_mat();
121 LVector3 &surface_normal, LPoint3 &interior_point)
const {
123 const LMatrix4 &mat = transform->get_mat();
127 surface_point = LPoint3::zero();
130 surface_point = _surface_point * mat;
134 surface_normal = LVector3::zero();
137 surface_normal = _surface_normal * mat;
141 interior_point = surface_point;
144 interior_point = _interior_point * mat;
161 return _contact_pos * transform->get_mat();
174 return _contact_normal * transform->get_mat();
186 LVector3 &contact_normal)
const {
188 const LMatrix4 &mat = transform->get_mat();
192 contact_pos = LPoint3::zero();
195 contact_pos = _contact_pos * mat;
199 contact_normal = LVector3::zero();
202 contact_normal = _contact_normal * mat;
211 void CollisionEntry::
212 output(std::ostream &out)
const {
213 out << _from_node_path;
215 out <<
" into " << _into_node_path;
225 void CollisionEntry::
226 write(std::ostream &out,
int indent_level)
const {
228 <<
"CollisionEntry:\n";
229 if (!_from_node_path.is_empty()) {
230 indent(out, indent_level + 2)
231 <<
"from " << _from_node_path <<
"\n";
234 indent(out, indent_level + 2)
235 <<
"into " << _into_node_path;
242 if (cpa !=
nullptr) {
248 indent(out, indent_level + 2)
252 indent(out, indent_level + 2)
256 indent(out, indent_level + 2)
262 indent(out, indent_level + 2)
269 void CollisionEntry::
270 check_clip_planes() {
271 _into_clip_planes = DCAST(
ClipPlaneAttrib, _into_node_path.get_net_state()->
get_attrib(ClipPlaneAttrib::get_class_slot()));
272 _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.
void list_tags(std::ostream &out, const std::string &separator="\n") const
Writes a list of all the tag keys assigned to the node to the indicated stream.
bool has_contact_normal() const
Returns true if the contact normal has been specified, false otherwise.
This functions similarly to a LightAttrib.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
get_respect_prev_transform
Returns true if the collision was detected by a CollisionTraverser whose respect_prev_transform flag ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
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.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.