Fix issue in HeightFieldShape
This commit is contained in:
parent
6489be1953
commit
be4cbbffd9
|
@ -40,8 +40,9 @@
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
/// Type of the collision shape
|
/// Type of the collision shape
|
||||||
enum CollisionShapeType {TRIANGLE, BOX, SPHERE, CONE, CYLINDER, CAPSULE, CONVEX_MESH, CONCAVE_MESH};
|
enum CollisionShapeType {TRIANGLE, BOX, SPHERE, CONE, CYLINDER,
|
||||||
const int NB_COLLISION_SHAPE_TYPES = 8;
|
CAPSULE, CONVEX_MESH, CONCAVE_MESH, HEIGHTFIELD};
|
||||||
|
const int NB_COLLISION_SHAPE_TYPES = 9;
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
class ProxyShape;
|
class ProxyShape;
|
||||||
|
@ -135,7 +136,7 @@ inline CollisionShapeType CollisionShape::getType() const {
|
||||||
|
|
||||||
// Return true if the collision shape type is a convex shape
|
// Return true if the collision shape type is a convex shape
|
||||||
inline bool CollisionShape::isConvex(CollisionShapeType shapeType) {
|
inline bool CollisionShape::isConvex(CollisionShapeType shapeType) {
|
||||||
return shapeType != CONCAVE_MESH;
|
return shapeType != CONCAVE_MESH && shapeType != HEIGHTFIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the scaling vector of the collision shape
|
// Return the scaling vector of the collision shape
|
||||||
|
|
|
@ -42,7 +42,7 @@ using namespace reactphysics3d;
|
||||||
HeightFieldShape::HeightFieldShape(int nbWidthGridPoints, int nbLengthGridPoints, decimal minHeight, decimal maxHeight,
|
HeightFieldShape::HeightFieldShape(int nbWidthGridPoints, int nbLengthGridPoints, decimal minHeight, decimal maxHeight,
|
||||||
const void* heightFieldData, HeightDataType dataType, int upAxis,
|
const void* heightFieldData, HeightDataType dataType, int upAxis,
|
||||||
decimal integerHeightScale)
|
decimal integerHeightScale)
|
||||||
: ConcaveShape(CONCAVE_MESH), mNbWidthGridPoints(nbWidthGridPoints), mNbLengthGridPoints(nbLengthGridPoints),
|
: ConcaveShape(HEIGHTFIELD), mNbWidthGridPoints(nbWidthGridPoints), mNbLengthGridPoints(nbLengthGridPoints),
|
||||||
mWidth(nbWidthGridPoints - 1), mLength(nbLengthGridPoints - 1), mMinHeight(minHeight),
|
mWidth(nbWidthGridPoints - 1), mLength(nbLengthGridPoints - 1), mMinHeight(minHeight),
|
||||||
mMaxHeight(maxHeight), mUpAxis(upAxis), mIntegerHeightScale(integerHeightScale),
|
mMaxHeight(maxHeight), mUpAxis(upAxis), mIntegerHeightScale(integerHeightScale),
|
||||||
mHeightDataType(dataType) {
|
mHeightDataType(dataType) {
|
||||||
|
@ -171,7 +171,7 @@ void HeightFieldShape::computeMinMaxGridCoordinates(int* minCoords, int* maxCoor
|
||||||
// Translate the min/max points such that the we compute grid points from [0 ... mNbWidthGridPoints]
|
// Translate the min/max points such that the we compute grid points from [0 ... mNbWidthGridPoints]
|
||||||
// and from [0 ... mNbLengthGridPoints] because the AABB coordinates range are [-mWdith/2 ... mWidth/2]
|
// and from [0 ... mNbLengthGridPoints] because the AABB coordinates range are [-mWdith/2 ... mWidth/2]
|
||||||
// and [-mLength/2 ... mLength/2]
|
// and [-mLength/2 ... mLength/2]
|
||||||
const Vector3 translateVec = mAABB.getExtent();
|
const Vector3 translateVec = mAABB.getExtent() * decimal(0.5);
|
||||||
minPoint += translateVec;
|
minPoint += translateVec;
|
||||||
maxPoint += translateVec;
|
maxPoint += translateVec;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user