minor update manual
fix vehicle demo (heightfield is broken, when using very large scaling factor) add btConeShape serialization, see Issue 725 add btGearConstraint get/set, see Issue 685 and Issue 671
This commit is contained in:
Binary file not shown.
@@ -281,7 +281,8 @@ const float TRIANGLE_SIZE=20.f;
|
||||
#endif
|
||||
|
||||
|
||||
btScalar maxHeight = 20000.f;
|
||||
//btScalar maxHeight = 20000.f;//exposes a bug
|
||||
btScalar maxHeight = 100;
|
||||
|
||||
bool useFloatDatam=false;
|
||||
bool flipQuadEdges=false;
|
||||
@@ -298,7 +299,8 @@ const float TRIANGLE_SIZE=20.f;
|
||||
localScaling[upIndex]=1.f;
|
||||
groundShape->setLocalScaling(localScaling);
|
||||
|
||||
tr.setOrigin(btVector3(0,9940,0));//-64.5f,0));
|
||||
//tr.setOrigin(btVector3(0,9940,0));
|
||||
tr.setOrigin(btVector3(0,49.4,0));
|
||||
|
||||
#endif //
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef struct bInvalidHandle {
|
||||
class btCompoundShapeChildData;
|
||||
class btCompoundShapeData;
|
||||
class btCylinderShapeData;
|
||||
class btConeShapeData;
|
||||
class btCapsuleShapeData;
|
||||
class btTriangleInfoData;
|
||||
class btTriangleInfoMapData;
|
||||
@@ -425,6 +426,16 @@ typedef struct bInvalidHandle {
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btConeShapeData
|
||||
{
|
||||
public:
|
||||
btConvexInternalShapeData m_convexInternalShapeData;
|
||||
int m_upIndex;
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btCapsuleShapeData
|
||||
{
|
||||
@@ -689,13 +700,14 @@ typedef struct bInvalidHandle {
|
||||
int m_useReferenceFrameA;
|
||||
int m_angularOnly;
|
||||
int m_enableAngularMotor;
|
||||
float m_motorTargetVelocity;
|
||||
float m_maxMotorImpulse;
|
||||
float m_lowerLimit;
|
||||
float m_upperLimit;
|
||||
float m_limitSoftness;
|
||||
float m_biasFactor;
|
||||
float m_relaxationFactor;
|
||||
double m_motorTargetVelocity;
|
||||
double m_maxMotorImpulse;
|
||||
double m_lowerLimit;
|
||||
double m_upperLimit;
|
||||
double m_limitSoftness;
|
||||
double m_biasFactor;
|
||||
double m_relaxationFactor;
|
||||
char m_padding1[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ btCollisionShape* btWorldImporter::convertCollisionShape( btCollisionShapeData*
|
||||
}
|
||||
|
||||
case CYLINDER_SHAPE_PROXYTYPE:
|
||||
case CONE_SHAPE_PROXYTYPE:
|
||||
case CAPSULE_SHAPE_PROXYTYPE:
|
||||
case BOX_SHAPE_PROXYTYPE:
|
||||
case SPHERE_SHAPE_PROXYTYPE:
|
||||
@@ -286,6 +287,38 @@ btCollisionShape* btWorldImporter::convertCollisionShape( btCollisionShapeData*
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case CONE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btConeShapeData* conData = (btConeShapeData*) shapeData;
|
||||
btVector3 halfExtents = implicitShapeDimensions;//+margin;
|
||||
switch (conData->m_upIndex)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
shape = createConeShapeX(halfExtents.getY(),halfExtents.getX());
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
shape = createConeShapeY(halfExtents.getX(),halfExtents.getY());
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
shape = createConeShapeZ(halfExtents.getX(),halfExtents.getZ());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf("unknown Cone up axis\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case MULTI_SPHERE_SHAPE_PROXYTYPE:
|
||||
@@ -1077,6 +1110,27 @@ btCollisionShape* btWorldImporter::createCylinderShapeZ(btScalar radius,btScalar
|
||||
return shape;
|
||||
}
|
||||
|
||||
btCollisionShape* btWorldImporter::createConeShapeX(btScalar radius,btScalar height)
|
||||
{
|
||||
btConeShapeX* shape = new btConeShapeX(radius,height);
|
||||
m_allocatedCollisionShapes.push_back(shape);
|
||||
return shape;
|
||||
}
|
||||
|
||||
btCollisionShape* btWorldImporter::createConeShapeY(btScalar radius,btScalar height)
|
||||
{
|
||||
btConeShape* shape = new btConeShape(radius,height);
|
||||
m_allocatedCollisionShapes.push_back(shape);
|
||||
return shape;
|
||||
}
|
||||
|
||||
btCollisionShape* btWorldImporter::createConeShapeZ(btScalar radius,btScalar height)
|
||||
{
|
||||
btConeShapeZ* shape = new btConeShapeZ(radius,height);
|
||||
m_allocatedCollisionShapes.push_back(shape);
|
||||
return shape;
|
||||
}
|
||||
|
||||
btTriangleIndexVertexArray* btWorldImporter::createTriangleMeshContainer()
|
||||
{
|
||||
btTriangleIndexVertexArray* in = new btTriangleIndexVertexArray();
|
||||
|
||||
@@ -162,6 +162,9 @@ public:
|
||||
virtual btCollisionShape* createCylinderShapeX(btScalar radius,btScalar height);
|
||||
virtual btCollisionShape* createCylinderShapeY(btScalar radius,btScalar height);
|
||||
virtual btCollisionShape* createCylinderShapeZ(btScalar radius,btScalar height);
|
||||
virtual btCollisionShape* createConeShapeX(btScalar radius,btScalar height);
|
||||
virtual btCollisionShape* createConeShapeY(btScalar radius,btScalar height);
|
||||
virtual btCollisionShape* createConeShapeZ(btScalar radius,btScalar height);
|
||||
virtual class btTriangleIndexVertexArray* createTriangleMeshContainer();
|
||||
virtual btBvhTriangleMeshShape* createBvhTriangleMeshShape(btStridingMeshInterface* trimesh, btOptimizedBvh* bvh);
|
||||
virtual btCollisionShape* createConvexTriangleMeshShape(btStridingMeshInterface* trimesh);
|
||||
|
||||
@@ -133,6 +133,7 @@ typedef unsigned long uintptr_t;
|
||||
#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCylinderShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btConeShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btTriangleInfoMap.h"
|
||||
#include "BulletCollision/Gimpact/btGImpactShape.h"
|
||||
@@ -176,6 +177,7 @@ char *includefiles[] = {
|
||||
"../../../src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btCompoundShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btCylinderShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btConeShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btCapsuleShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btTriangleInfoMap.h",
|
||||
"../../../src/BulletCollision/Gimpact/btGImpactShape.h",
|
||||
|
||||
@@ -62,6 +62,10 @@ void btConeShape::setConeUpIndex(int upIndex)
|
||||
default:
|
||||
btAssert(0);
|
||||
};
|
||||
|
||||
m_implicitShapeDimensions[m_coneIndices[0]] = m_radius;
|
||||
m_implicitShapeDimensions[m_coneIndices[1]] = m_height;
|
||||
m_implicitShapeDimensions[m_coneIndices[2]] = m_radius;
|
||||
}
|
||||
|
||||
btVector3 btConeShape::coneLocalSupport(const btVector3& v) const
|
||||
|
||||
@@ -90,6 +90,13 @@ public:
|
||||
}
|
||||
|
||||
virtual void setLocalScaling(const btVector3& scaling);
|
||||
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -104,19 +111,61 @@ class btConeShapeX : public btConeShape
|
||||
return btVector3 (1,0,0);
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "ConeX";
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
///btConeShapeZ implements a Cone shape, around the Z axis
|
||||
class btConeShapeZ : public btConeShape
|
||||
{
|
||||
public:
|
||||
btConeShapeZ(btScalar radius,btScalar height);
|
||||
public:
|
||||
btConeShapeZ(btScalar radius,btScalar height);
|
||||
|
||||
virtual btVector3 getAnisotropicRollingFrictionDirection() const
|
||||
{
|
||||
return btVector3 (0,0,1);
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const
|
||||
{
|
||||
return "ConeZ";
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
|
||||
struct btConeShapeData
|
||||
{
|
||||
btConvexInternalShapeData m_convexInternalShapeData;
|
||||
|
||||
int m_upIndex;
|
||||
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
SIMD_FORCE_INLINE int btConeShape::calculateSerializeBufferSize() const
|
||||
{
|
||||
return sizeof(btConeShapeData);
|
||||
}
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
SIMD_FORCE_INLINE const char* btConeShape::serialize(void* dataBuffer, btSerializer* serializer) const
|
||||
{
|
||||
btConeShapeData* shapeData = (btConeShapeData*) dataBuffer;
|
||||
|
||||
btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer);
|
||||
|
||||
shapeData->m_upIndex = m_coneIndices[1];
|
||||
|
||||
return "btConeShapeData";
|
||||
}
|
||||
|
||||
#endif //BT_CONE_MINKOWSKI_H
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ subject to the following restrictions:
|
||||
#include "btTriangleShape.h"
|
||||
#include "btSphereShape.h"
|
||||
#include "btCylinderShape.h"
|
||||
#include "btConeShape.h"
|
||||
#include "btCapsuleShape.h"
|
||||
#include "btConvexHullShape.h"
|
||||
#include "btConvexPointCloudShape.h"
|
||||
@@ -336,6 +337,11 @@ btScalar btConvexShape::getMarginNonVirtual () const
|
||||
btCylinderShape* cylShape = (btCylinderShape*)this;
|
||||
return cylShape->getMarginNV();
|
||||
}
|
||||
case CONE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btConeShape* conShape = (btConeShape*)this;
|
||||
return conShape->getMarginNV();
|
||||
}
|
||||
case CAPSULE_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btCapsuleShape* capsuleShape = (btCapsuleShape*)this;
|
||||
|
||||
@@ -36,17 +36,48 @@ public:
|
||||
///internal method used by the constraint solver, don't use them directly
|
||||
virtual void getInfo1 (btConstraintInfo1* info);
|
||||
|
||||
///internal method used by the constraint solver, don't use them directly
|
||||
virtual void getInfo2 (btConstraintInfo2* info);
|
||||
|
||||
virtual void setParam(int num, btScalar value, int axis = -1)
|
||||
///internal method used by the constraint solver, don't use them directly
|
||||
virtual void getInfo2 (btConstraintInfo2* info);
|
||||
|
||||
void setAxisA(btVector3& axisA)
|
||||
{
|
||||
btAssert(0);
|
||||
};
|
||||
m_axisInA = axisA;
|
||||
}
|
||||
void setAxisB(btVector3& axisB)
|
||||
{
|
||||
m_axisInB = axisB;
|
||||
}
|
||||
void setRatio(btScalar ratio)
|
||||
{
|
||||
m_ratio = ratio;
|
||||
}
|
||||
const btVector3& getAxisA() const
|
||||
{
|
||||
return m_axisInA;
|
||||
}
|
||||
const btVector3& getAxisB() const
|
||||
{
|
||||
return m_axisInB;
|
||||
}
|
||||
btScalar getRatio() const
|
||||
{
|
||||
return m_ratio;
|
||||
}
|
||||
|
||||
|
||||
virtual void setParam(int num, btScalar value, int axis = -1)
|
||||
{
|
||||
(void) num;
|
||||
(void) value;
|
||||
(void) axis;
|
||||
btAssert(0);
|
||||
}
|
||||
|
||||
///return the local value of parameter
|
||||
virtual btScalar getParam(int num, int axis = -1) const
|
||||
{
|
||||
(void) num;
|
||||
(void) axis;
|
||||
btAssert(0);
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user