31 if (enableDynamicAabbTree)
64 shape->
getAabb(localTransform,localAabbMin,localAabbMax);
90 m_children[childIndex].m_transform = newChildTransform;
96 m_children[childIndex].m_childShape->getAabb(newChildTransform,localAabbMin,localAabbMax);
102 if (shouldRecalculateLocalAabb)
118 m_children[childShapeIndex].m_node->dataAsInt = childShapeIndex;
156 for (
int i=0;i<3;i++)
185 btVector3 extent = localHalfExtents.
dot3(abs_b[0], abs_b[1], abs_b[2]);
186 aabbMin = center-extent;
187 aabbMax = center+extent;
197 getAabb(ident,aabbMin,aabbMax);
205 inertia[0] = mass/(
btScalar(12.0)) * (ly*ly + lz*lz);
206 inertia[1] = mass/(
btScalar(12.0)) * (lx*lx + lz*lz);
207 inertia[2] = mass/(
btScalar(12.0)) * (lx*lx + ly*ly);
222 for (k = 0; k < n; k++)
225 center +=
m_children[k].m_transform.getOrigin() * masses[k];
226 totalMass += masses[k];
235 for ( k = 0; k < n; k++)
238 m_children[k].m_childShape->calculateLocalInertia(masses[k], i);
265 tensor[0] += masses[k] * j[0];
266 tensor[1] += masses[k] * j[1];
267 tensor[2] += masses[k] * j[2];
271 inertia.
setValue(tensor[0][0], tensor[1][1], tensor[2][2]);
287 m_children[i].m_childShape->setLocalScaling(childScale);
345 const char* structType =
m_children[i].m_childShape->serialize(chunk->
m_oldPtr,serializer);
354 return "btCompoundShapeData";
virtual btScalar getMargin() const
void push_back(const T &_Val)
btCompoundShape(bool enableDynamicAabbTree=true)
virtual void recalculateLocalAabb()
Re-calculate the local Aabb.
btCompoundShapeChildData * m_childShapePtr
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
btDbvt * m_dynamicAabbTree
btAlignedObjectArray< btCompoundShapeChild > m_children
virtual void * getUniquePointer(void *oldPtr)=0
The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes ...
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btDbvtNode * insert(const btDbvtVolume &box, void *data)
btCollisionShape * m_childShape
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
btCollisionShapeData m_collisionShapeData
struct btDbvtNode * m_node
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
void calculatePrincipalAxisTransform(btScalar *masses, btTransform &principal, btVector3 &inertia) const
computes the exact moment of inertia and the transform from the coordinate system defined by the prin...
void swap(int index0, int index1)
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t...
const btScalar & x() const
Return the x value.
int m_updateRevision
increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be up...
void update(btDbvtNode *leaf, int lookahead=-1)
int size() const
return the number of elements in the array
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb's default implementation is brute force, expected derived classes to implement a fast dedicat...
btMatrix3x3 absolute() const
Return the matrix with all values non negative.
void diagonalize(btMatrix3x3 &rot, btScalar threshold, int maxSteps)
diagonalizes this matrix by the Jacobi method.
btTransform & getChildTransform(int index)
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
btTransformFloatData m_transform
#define btAlignedFree(ptr)
void setValue(const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
Set the values of the matrix explicitly (row major)
btScalar m_collisionMargin
const btScalar & y() const
Return the y value.
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
btScalar length2() const
Return the length of the vector squared.
virtual ~btCompoundShape()
void updateChildTransform(int childIndex, const btTransform &newChildTransform, bool shouldRecalculateLocalAabb=true)
set a new transform for a child, and update internal data structures (local aabb and dynamic tree) ...
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
void createAabbTreeFromChildren()
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btMatrix3x3 transpose() const
Return the transpose of the matrix.
virtual btScalar getMargin() const =0
virtual void setLocalScaling(const btVector3 &scaling)
btVector3 dot3(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2) const
#define btAlignedAlloc(size, alignment)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
void removeChildShapeByIndex(int childShapeindex)
virtual void removeChildShape(btCollisionShape *shape)
Remove all children shapes that contain the specified shape.
virtual void * findPointer(void *oldPtr)=0
btCollisionShapeData * m_childShape
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
void remove(btDbvtNode *leaf)
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
static btDbvtVolume bounds(const tNodeArray &leaves)
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
const btScalar & z() const
Return the z value.