26 BulletCylinderShape(
const LVector3 &half_extents, BulletUpAxis up) :
27 _half_extents(half_extents),
30 btVector3 btHalfExtents = LVecBase3_to_btVector3(half_extents);
34 _shape =
new btCylinderShapeX(btHalfExtents);
37 _shape =
new btCylinderShape(btHalfExtents);
40 _shape =
new btCylinderShapeZ(btHalfExtents);
43 bullet_cat.error() <<
"invalid up-axis:" << up << endl;
48 _shape->setUserPointer(
this);
55 BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) :
60 _shape =
new btCylinderShapeX(btVector3(0.5 * height, radius, radius));
61 _half_extents = btVector3_to_LVector3(btVector3(0.5 * height, radius, radius));
64 _shape =
new btCylinderShape(btVector3(radius, 0.5 * height, radius));
65 _half_extents = btVector3_to_LVector3(btVector3(radius, 0.5 * height, radius));
68 _shape =
new btCylinderShapeZ(btVector3(radius, radius, 0.5 * height));
69 _half_extents = btVector3_to_LVector3(btVector3(radius, radius, 0.5 * height));
72 bullet_cat.error() <<
"invalid up-axis:" << up << endl;
77 _shape->setUserPointer(
this);
88 _half_extents = copy._half_extents;
90 btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
94 _shape =
new btCylinderShapeX(btHalfExtents);
97 _shape =
new btCylinderShape(btHalfExtents);
100 _shape =
new btCylinderShapeZ(btHalfExtents);
103 bullet_cat.error() <<
"invalid up-axis:" << _up << endl;
108 _shape->setUserPointer(
this);
114 btCollisionShape *BulletCylinderShape::
123 PN_stdfloat BulletCylinderShape::
127 return (PN_stdfloat)_shape->getRadius();
133 LVecBase3 BulletCylinderShape::
134 get_half_extents_without_margin()
const {
137 return btVector3_to_LVecBase3(_shape->getHalfExtentsWithoutMargin());
143 LVecBase3 BulletCylinderShape::
144 get_half_extents_with_margin()
const {
147 return btVector3_to_LVecBase3(_shape->getHalfExtentsWithMargin());
168 _half_extents.write_datagram(dg);
185 param->fillin(scan, manager);
194 void BulletCylinderShape::
197 nassertv(_shape ==
nullptr);
202 _half_extents.read_datagram(scan);
203 _up = (BulletUpAxis) scan.
get_int8();
205 btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
209 _shape =
new btCylinderShapeX(btHalfExtents);
212 _shape =
new btCylinderShape(btHalfExtents);
215 _shape =
new btCylinderShapeZ(btHalfExtents);
218 bullet_cat.error() <<
"invalid up-axis:" << _up << endl;
223 _shape->setUserPointer(
this);
224 _shape->setMargin(margin);
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Base class for objects that can be written to and read from Bam files.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
void add_int8(int8_t value)
Adds a signed 8-bit integer to the datagram.
Similar to MutexHolder, but for a light mutex.
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.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A class to retrieve the individual data elements previously stored in a Datagram.
int8_t get_int8()
Extracts a signed 8-bit integer.
TypeHandle is the identifier used to differentiate C++ class types.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.