50 return entry.
get_into()->test_intersection_from_segment(entry);
56void CollisionSegment::
57xform(
const LMatrix4 &mat) {
61 CollisionSolid::xform(mat);
77void CollisionSegment::
78output(std::ostream &out)
const {
79 out <<
"segment, a (" << _a <<
"), b (" << _b <<
")";
95 if (!proj->
extrude(point, _a, _b)) {
96 _a = LPoint3::origin();
97 _b = _a + LVector3::forward();
101 mark_internal_bounds_stale();
111compute_internal_bounds()
const {
113 LVector3 pdelta = _b - _a;
116 PN_stdfloat d2 = pdelta.length_squared();
117 if (d2 < collision_parabola_bounds_threshold * collision_parabola_bounds_threshold) {
118 LPoint3 pmid = (_a + _b) * 0.5f;
122 LMatrix4 from_segment;
123 look_at(from_segment, pdelta, LPoint3(0,0,1), CS_zup_right);
124 from_segment.set_row(3, _a);
126 PN_stdfloat max_y = sqrt(d2) + 0.01;
129 LPoint3(0.01, max_y, 0.01), LPoint3(-0.01, max_y, 0.01),
130 LPoint3(-0.01, -0.01, -0.01), LPoint3(0.01, 0.01, -0.01),
131 LPoint3(0.01, -0.01, 0.01), LPoint3(-0.01, -0.01, 0.01));
133 volume->xform(from_segment);
141void CollisionSegment::
143 if (collide_cat.is_debug()) {
145 <<
"Recomputing viz for " << *
this <<
"\n";
153 vertex.add_data3(_a);
154 vertex.add_data3(_b);
157 line->add_next_vertices(2);
158 line->close_primitive();
161 geom->add_primitive(line);
163 _viz_geom->add_geom(geom, get_other_viz_state());
164 _bounds_viz_geom->add_geom(geom, get_other_bounds_viz_state());
182 _a.write_datagram(dg);
183 _b.write_datagram(dg);
198 node->fillin(scan, manager);
207void CollisionSegment::
209 CollisionSolid::fillin(scan, manager);
210 _a.read_datagram(scan);
211 _b.read_datagram(scan);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This defines a bounding convex hexahedron.
This defines a bounding sphere, consisting of a center and a radius.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
Defines a single collision event.
get_into
Returns the CollisionSolid pointer for the particular solid was collided into.
A finite line segment, with two specific endpoints but no thickness.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionSegment.
bool set_from_lens(LensNode *camera, const LPoint2 &point)
Accepts a LensNode and a 2-d point in the range [-1,1].
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
CollisionSegment()
Creates an invalid segment.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
The abstract base class for all things that can collide with other things in the world,...
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
Defines a series of disconnected line segments.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
A container for geometry primitives.
A node that contains a Lens.
Lens * get_lens(int index=0) const
Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a...
A base class for any number of different kinds of lenses, linear and otherwise.
bool extrude(const LPoint2 &point2d, LPoint3 &near_point, LPoint3 &far_point) const
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (...
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.