14 #ifndef COLLISIONCAPSULE_H
15 #define COLLISIONCAPSULE_H
31 INLINE
explicit CollisionCapsule(PN_stdfloat ax, PN_stdfloat ay, PN_stdfloat az,
32 PN_stdfloat bx, PN_stdfloat by, PN_stdfloat bz,
35 virtual LPoint3 get_collision_origin()
const;
47 virtual void xform(
const LMatrix4 &mat);
52 virtual void output(std::ostream &out)
const;
54 INLINE
static void flush_level();
57 INLINE
void set_point_a(
const LPoint3 &a);
58 INLINE
void set_point_a(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
59 INLINE
const LPoint3 &get_point_a()
const;
61 INLINE
void set_point_b(
const LPoint3 &b);
62 INLINE
void set_point_b(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
63 INLINE
const LPoint3 &get_point_b()
const;
65 INLINE
void set_radius(PN_stdfloat radius);
66 INLINE PN_stdfloat get_radius()
const;
69 MAKE_PROPERTY(point_a, get_point_a, set_point_a);
70 MAKE_PROPERTY(point_b, get_point_b, set_point_b);
71 MAKE_PROPERTY(radius, get_radius, set_radius);
88 test_intersection_from_parabola(
const CollisionEntry &entry)
const;
90 virtual void fill_viz_geom();
93 void recalc_internals();
95 LVertex calc_sphere1_vertex(
int ri,
int si,
int num_rings,
int num_slices);
96 LVertex calc_sphere2_vertex(
int ri,
int si,
int num_rings,
int num_slices,
99 static void calc_closest_segment_points(
double &t1,
double &t2,
100 const LPoint3 &from1,
const LVector3 &delta1,
101 const LPoint3 &from2,
const LVector3 &delta2);
102 bool intersects_line(
double &t1,
double &t2,
103 const LPoint3 &from,
const LVector3 &delta,
104 PN_stdfloat inflate_radius)
const;
105 static bool sphere_intersects_line(
double &t1,
double &t2, PN_stdfloat center_y,
106 const LPoint3 &from,
const LVector3 &delta,
108 bool intersects_parabola(
double &t,
const LParabola ¶bola,
109 double t1,
double t2,
110 const LPoint3 &p1,
const LPoint3 &p2)
const;
111 void calculate_surface_point_and_normal(
const LPoint3 &surface_point,
113 LPoint3 &result_point,
114 LVector3 &result_normal)
const;
116 const LPoint3 &into_intersection_point,
117 double extra_radius)
const;
132 static void register_with_read_factory();
143 static void init_type() {
144 CollisionSolid::init_type();
146 CollisionSolid::get_class_type());
149 return get_class_type();
151 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A cuboid collision volume or object.
This implements a solid consisting of a cylinder with hemispherical endcaps, also known as a capsule ...
Defines a single collision event.
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.
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
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...
A lightweight class that represents a single element that may be timed and/or counted via stats.
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...