2017-08-01 20:30:58 +08:00
|
|
|
/*
|
|
|
|
Bullet Continuous Collision Detection and Physics Library
|
|
|
|
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
In no event will the authors be held liable for any damages arising from the use of this software.
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it freely,
|
|
|
|
subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "btHeightfieldTerrainShape.h"
|
|
|
|
|
|
|
|
#include "LinearMath/btTransformUtil.h"
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
btHeightfieldTerrainShape::btHeightfieldTerrainShape(
|
|
|
|
int heightStickWidth, int heightStickLength, const void* heightfieldData,
|
|
|
|
btScalar heightScale, btScalar minHeight, btScalar maxHeight, int upAxis,
|
|
|
|
PHY_ScalarType hdt, bool flipQuadEdges)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
initialize(heightStickWidth, heightStickLength, heightfieldData,
|
2019-01-03 21:26:51 +08:00
|
|
|
heightScale, minHeight, maxHeight, upAxis, hdt,
|
|
|
|
flipQuadEdges);
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
btHeightfieldTerrainShape::btHeightfieldTerrainShape(int heightStickWidth, int heightStickLength, const void* heightfieldData, btScalar maxHeight, int upAxis, bool useFloatData, bool flipQuadEdges)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
// legacy constructor: support only float or unsigned char,
|
|
|
|
// and min height is zero
|
|
|
|
PHY_ScalarType hdt = (useFloatData) ? PHY_FLOAT : PHY_UCHAR;
|
|
|
|
btScalar minHeight = 0.0f;
|
|
|
|
|
|
|
|
// previously, height = uchar * maxHeight / 65535.
|
|
|
|
// So to preserve legacy behavior, heightScale = maxHeight / 65535
|
|
|
|
btScalar heightScale = maxHeight / 65535;
|
|
|
|
|
|
|
|
initialize(heightStickWidth, heightStickLength, heightfieldData,
|
2019-01-03 21:26:51 +08:00
|
|
|
heightScale, minHeight, maxHeight, upAxis, hdt,
|
|
|
|
flipQuadEdges);
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::initialize(
|
|
|
|
int heightStickWidth, int heightStickLength, const void* heightfieldData,
|
|
|
|
btScalar heightScale, btScalar minHeight, btScalar maxHeight, int upAxis,
|
|
|
|
PHY_ScalarType hdt, bool flipQuadEdges)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
// validation
|
2019-01-03 21:26:51 +08:00
|
|
|
btAssert(heightStickWidth > 1); // && "bad width");
|
|
|
|
btAssert(heightStickLength > 1); // && "bad length");
|
|
|
|
btAssert(heightfieldData); // && "null heightfield data");
|
2017-08-01 20:30:58 +08:00
|
|
|
// btAssert(heightScale) -- do we care? Trust caller here
|
2019-01-03 21:26:51 +08:00
|
|
|
btAssert(minHeight <= maxHeight); // && "bad min/max height");
|
|
|
|
btAssert(upAxis >= 0 && upAxis < 3); // && "bad upAxis--should be in range [0,2]");
|
|
|
|
btAssert(hdt != PHY_UCHAR || hdt != PHY_FLOAT || hdt != PHY_SHORT); // && "Bad height data type enum");
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
// initialize member variables
|
|
|
|
m_shapeType = TERRAIN_SHAPE_PROXYTYPE;
|
|
|
|
m_heightStickWidth = heightStickWidth;
|
|
|
|
m_heightStickLength = heightStickLength;
|
|
|
|
m_minHeight = minHeight;
|
|
|
|
m_maxHeight = maxHeight;
|
2019-01-03 21:26:51 +08:00
|
|
|
m_width = (btScalar)(heightStickWidth - 1);
|
|
|
|
m_length = (btScalar)(heightStickLength - 1);
|
2017-08-01 20:30:58 +08:00
|
|
|
m_heightScale = heightScale;
|
|
|
|
m_heightfieldDataUnknown = heightfieldData;
|
|
|
|
m_heightDataType = hdt;
|
|
|
|
m_flipQuadEdges = flipQuadEdges;
|
|
|
|
m_useDiamondSubdivision = false;
|
|
|
|
m_useZigzagSubdivision = false;
|
|
|
|
m_upAxis = upAxis;
|
|
|
|
m_localScaling.setValue(btScalar(1.), btScalar(1.), btScalar(1.));
|
|
|
|
|
|
|
|
// determine min/max axis-aligned bounding box (aabb) values
|
|
|
|
switch (m_upAxis)
|
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
case 0:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
m_localAabbMin.setValue(m_minHeight, 0, 0);
|
|
|
|
m_localAabbMax.setValue(m_maxHeight, m_width, m_length);
|
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
case 1:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
m_localAabbMin.setValue(0, m_minHeight, 0);
|
|
|
|
m_localAabbMax.setValue(m_width, m_maxHeight, m_length);
|
|
|
|
break;
|
|
|
|
};
|
2019-01-03 21:26:51 +08:00
|
|
|
case 2:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
m_localAabbMin.setValue(0, 0, m_minHeight);
|
|
|
|
m_localAabbMax.setValue(m_width, m_length, m_maxHeight);
|
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
default:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
//need to get valid m_upAxis
|
2019-01-03 21:26:51 +08:00
|
|
|
btAssert(0); // && "Bad m_upAxis");
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// remember origin (defined as exact middle of aabb)
|
|
|
|
m_localOrigin = btScalar(0.5) * (m_localAabbMin + m_localAabbMax);
|
|
|
|
}
|
|
|
|
|
|
|
|
btHeightfieldTerrainShape::~btHeightfieldTerrainShape()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
btVector3 halfExtents = (m_localAabbMax - m_localAabbMin) * m_localScaling * btScalar(0.5);
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
btVector3 localOrigin(0, 0, 0);
|
|
|
|
localOrigin[m_upAxis] = (m_minHeight + m_maxHeight) * btScalar(0.5);
|
|
|
|
localOrigin *= m_localScaling;
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
btMatrix3x3 abs_b = t.getBasis().absolute();
|
2017-08-01 20:30:58 +08:00
|
|
|
btVector3 center = t.getOrigin();
|
2019-01-03 21:26:51 +08:00
|
|
|
btVector3 extent = halfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]);
|
|
|
|
extent += btVector3(getMargin(), getMargin(), getMargin());
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
aabbMin = center - extent;
|
|
|
|
aabbMax = center + extent;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This returns the "raw" (user's initial) height, not the actual height.
|
|
|
|
/// The actual height needs to be adjusted to be relative to the center
|
|
|
|
/// of the heightfield's AABB.
|
|
|
|
btScalar
|
2019-01-03 21:26:51 +08:00
|
|
|
btHeightfieldTerrainShape::getRawHeightFieldValue(int x, int y) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
btScalar val = 0.f;
|
|
|
|
switch (m_heightDataType)
|
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
case PHY_FLOAT:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
val = m_heightfieldDataFloat[(y * m_heightStickWidth) + x];
|
2017-08-01 20:30:58 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
case PHY_UCHAR:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
unsigned char heightFieldValue = m_heightfieldDataUnsignedChar[(y * m_heightStickWidth) + x];
|
2017-08-01 20:30:58 +08:00
|
|
|
val = heightFieldValue * m_heightScale;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
case PHY_SHORT:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
short hfValue = m_heightfieldDataShort[(y * m_heightStickWidth) + x];
|
|
|
|
val = hfValue * m_heightScale;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
default:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
btAssert(!"Bad m_heightDataType");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// this returns the vertex in bullet-local coordinates
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::getVertex(int x, int y, btVector3& vertex) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
btAssert(x >= 0);
|
|
|
|
btAssert(y >= 0);
|
|
|
|
btAssert(x < m_heightStickWidth);
|
|
|
|
btAssert(y < m_heightStickLength);
|
2017-08-01 20:30:58 +08:00
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
btScalar height = getRawHeightFieldValue(x, y);
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
switch (m_upAxis)
|
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
case 0:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
vertex.setValue(
|
|
|
|
height - m_localOrigin.getX(),
|
|
|
|
(-m_width / btScalar(2.0)) + x,
|
|
|
|
(-m_length / btScalar(2.0)) + y);
|
2017-08-01 20:30:58 +08:00
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
case 1:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
vertex.setValue(
|
2019-01-03 21:26:51 +08:00
|
|
|
(-m_width / btScalar(2.0)) + x,
|
|
|
|
height - m_localOrigin.getY(),
|
|
|
|
(-m_length / btScalar(2.0)) + y);
|
2017-08-01 20:30:58 +08:00
|
|
|
break;
|
|
|
|
};
|
2019-01-03 21:26:51 +08:00
|
|
|
case 2:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
vertex.setValue(
|
2019-01-03 21:26:51 +08:00
|
|
|
(-m_width / btScalar(2.0)) + x,
|
|
|
|
(-m_length / btScalar(2.0)) + y,
|
|
|
|
height - m_localOrigin.getZ());
|
2017-08-01 20:30:58 +08:00
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
default:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
//need to get valid m_upAxis
|
|
|
|
btAssert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
vertex *= m_localScaling;
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
2019-01-03 21:26:51 +08:00
|
|
|
getQuantized(
|
|
|
|
btScalar x)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
if (x < 0.0)
|
|
|
|
{
|
|
|
|
return (int)(x - 0.5);
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
return (int)(x + 0.5);
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// given input vector, return quantized version
|
|
|
|
/**
|
|
|
|
This routine is basically determining the gridpoint indices for a given
|
|
|
|
input vector, answering the question: "which gridpoint is closest to the
|
|
|
|
provided point?".
|
|
|
|
|
|
|
|
"with clamp" means that we restrict the point to be in the heightfield's
|
|
|
|
axis-aligned bounding box.
|
|
|
|
*/
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::quantizeWithClamp(int* out, const btVector3& point, int /*isMax*/) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
btVector3 clampedPoint(point);
|
|
|
|
clampedPoint.setMax(m_localAabbMin);
|
|
|
|
clampedPoint.setMin(m_localAabbMax);
|
|
|
|
|
|
|
|
out[0] = getQuantized(clampedPoint.getX());
|
|
|
|
out[1] = getQuantized(clampedPoint.getY());
|
|
|
|
out[2] = getQuantized(clampedPoint.getZ());
|
|
|
|
}
|
|
|
|
|
|
|
|
/// process all triangles within the provided axis-aligned bounding box
|
|
|
|
/**
|
|
|
|
basic algorithm:
|
|
|
|
- convert input aabb to local coordinates (scale down and shift for local origin)
|
|
|
|
- convert input aabb to a range of heightfield grid points (quantize)
|
|
|
|
- iterate over all triangles in that subset of the grid
|
|
|
|
*/
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback, const btVector3& aabbMin, const btVector3& aabbMax) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
// scale down the input aabb's so they are in local (non-scaled) coordinates
|
2019-01-03 21:26:51 +08:00
|
|
|
btVector3 localAabbMin = aabbMin * btVector3(1.f / m_localScaling[0], 1.f / m_localScaling[1], 1.f / m_localScaling[2]);
|
|
|
|
btVector3 localAabbMax = aabbMax * btVector3(1.f / m_localScaling[0], 1.f / m_localScaling[1], 1.f / m_localScaling[2]);
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
// account for local origin
|
|
|
|
localAabbMin += m_localOrigin;
|
|
|
|
localAabbMax += m_localOrigin;
|
|
|
|
|
|
|
|
//quantize the aabbMin and aabbMax, and adjust the start/end ranges
|
2019-01-03 21:26:51 +08:00
|
|
|
int quantizedAabbMin[3];
|
|
|
|
int quantizedAabbMax[3];
|
|
|
|
quantizeWithClamp(quantizedAabbMin, localAabbMin, 0);
|
|
|
|
quantizeWithClamp(quantizedAabbMax, localAabbMax, 1);
|
|
|
|
|
2017-08-01 20:30:58 +08:00
|
|
|
// expand the min/max quantized values
|
|
|
|
// this is to catch the case where the input aabb falls between grid points!
|
2019-01-03 21:26:51 +08:00
|
|
|
for (int i = 0; i < 3; ++i)
|
|
|
|
{
|
2017-08-01 20:30:58 +08:00
|
|
|
quantizedAabbMin[i]--;
|
|
|
|
quantizedAabbMax[i]++;
|
2019-01-03 21:26:51 +08:00
|
|
|
}
|
2017-08-01 20:30:58 +08:00
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
int startX = 0;
|
|
|
|
int endX = m_heightStickWidth - 1;
|
|
|
|
int startJ = 0;
|
|
|
|
int endJ = m_heightStickLength - 1;
|
2017-08-01 20:30:58 +08:00
|
|
|
|
|
|
|
switch (m_upAxis)
|
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
case 0:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[1] > startX)
|
2017-08-01 20:30:58 +08:00
|
|
|
startX = quantizedAabbMin[1];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[1] < endX)
|
2017-08-01 20:30:58 +08:00
|
|
|
endX = quantizedAabbMax[1];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[2] > startJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
startJ = quantizedAabbMin[2];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[2] < endJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
endJ = quantizedAabbMax[2];
|
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
case 1:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[0] > startX)
|
2017-08-01 20:30:58 +08:00
|
|
|
startX = quantizedAabbMin[0];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[0] < endX)
|
2017-08-01 20:30:58 +08:00
|
|
|
endX = quantizedAabbMax[0];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[2] > startJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
startJ = quantizedAabbMin[2];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[2] < endJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
endJ = quantizedAabbMax[2];
|
|
|
|
break;
|
|
|
|
};
|
2019-01-03 21:26:51 +08:00
|
|
|
case 2:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[0] > startX)
|
2017-08-01 20:30:58 +08:00
|
|
|
startX = quantizedAabbMin[0];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[0] < endX)
|
2017-08-01 20:30:58 +08:00
|
|
|
endX = quantizedAabbMax[0];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMin[1] > startJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
startJ = quantizedAabbMin[1];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (quantizedAabbMax[1] < endJ)
|
2017-08-01 20:30:58 +08:00
|
|
|
endJ = quantizedAabbMax[1];
|
|
|
|
break;
|
|
|
|
}
|
2019-01-03 21:26:51 +08:00
|
|
|
default:
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
//need to get valid m_upAxis
|
|
|
|
btAssert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
for (int j = startJ; j < endJ; j++)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
for (int x = startX; x < endX; x++)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
btVector3 vertices[3];
|
2019-01-03 21:26:51 +08:00
|
|
|
if (m_flipQuadEdges || (m_useDiamondSubdivision && !((j + x) & 1)) || (m_useZigzagSubdivision && !(j & 1)))
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
//first triangle
|
|
|
|
getVertex(x, j, vertices[0]);
|
|
|
|
getVertex(x, j + 1, vertices[1]);
|
|
|
|
getVertex(x + 1, j + 1, vertices[2]);
|
|
|
|
callback->processTriangle(vertices, x, j);
|
|
|
|
//second triangle
|
|
|
|
// getVertex(x,j,vertices[0]);//already got this vertex before, thanks to Danny Chapman
|
|
|
|
getVertex(x + 1, j + 1, vertices[1]);
|
|
|
|
getVertex(x + 1, j, vertices[2]);
|
|
|
|
callback->processTriangle(vertices, x, j);
|
|
|
|
}
|
|
|
|
else
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
2019-01-03 21:26:51 +08:00
|
|
|
//first triangle
|
|
|
|
getVertex(x, j, vertices[0]);
|
|
|
|
getVertex(x, j + 1, vertices[1]);
|
|
|
|
getVertex(x + 1, j, vertices[2]);
|
|
|
|
callback->processTriangle(vertices, x, j);
|
|
|
|
//second triangle
|
|
|
|
getVertex(x + 1, j, vertices[0]);
|
|
|
|
//getVertex(x,j+1,vertices[1]);
|
|
|
|
getVertex(x + 1, j + 1, vertices[2]);
|
|
|
|
callback->processTriangle(vertices, x, j);
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::calculateLocalInertia(btScalar, btVector3& inertia) const
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
//moving concave objects not supported
|
2019-01-03 21:26:51 +08:00
|
|
|
|
|
|
|
inertia.setValue(btScalar(0.), btScalar(0.), btScalar(0.));
|
2017-08-01 20:30:58 +08:00
|
|
|
}
|
|
|
|
|
2019-01-03 21:26:51 +08:00
|
|
|
void btHeightfieldTerrainShape::setLocalScaling(const btVector3& scaling)
|
2017-08-01 20:30:58 +08:00
|
|
|
{
|
|
|
|
m_localScaling = scaling;
|
|
|
|
}
|
|
|
|
const btVector3& btHeightfieldTerrainShape::getLocalScaling() const
|
|
|
|
{
|
|
|
|
return m_localScaling;
|
|
|
|
}
|