Move method in cpp file
This commit is contained in:
parent
274483aee2
commit
315c701f34
|
@ -208,6 +208,31 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, ProxySh
|
||||||
return triangleCallback.getIsHit();
|
return triangleCallback.getIsHit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the vertex (local-coordinates) of the height field at a given (x,y) position
|
||||||
|
Vector3 HeightFieldShape::getVertexAt(int x, int y) const {
|
||||||
|
|
||||||
|
// Get the height value
|
||||||
|
const decimal height = getHeightAt(x, y);
|
||||||
|
|
||||||
|
// Height values origin
|
||||||
|
const decimal heightOrigin = -(mMaxHeight - mMinHeight) * decimal(0.5) - mMinHeight;
|
||||||
|
|
||||||
|
Vector3 vertex;
|
||||||
|
switch (mUpAxis) {
|
||||||
|
case 0: vertex = Vector3(heightOrigin + height, -mWidth * decimal(0.5) + x, -mLength * decimal(0.5) + y);
|
||||||
|
break;
|
||||||
|
case 1: vertex = Vector3(-mWidth * decimal(0.5) + x, heightOrigin + height, -mLength * decimal(0.5) + y);
|
||||||
|
break;
|
||||||
|
case 2: vertex = Vector3(-mWidth * decimal(0.5) + x, -mLength * decimal(0.5) + y, heightOrigin + height);
|
||||||
|
break;
|
||||||
|
default: assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(mAABB.contains(vertex));
|
||||||
|
|
||||||
|
return vertex * mScaling;
|
||||||
|
}
|
||||||
|
|
||||||
// Raycast test between a ray and a triangle of the heightfield
|
// Raycast test between a ray and a triangle of the heightfield
|
||||||
void TriangleOverlapCallback::testTriangle(const Vector3* trianglePoints) {
|
void TriangleOverlapCallback::testTriangle(const Vector3* trianglePoints) {
|
||||||
|
|
||||||
|
|
|
@ -219,31 +219,6 @@ inline void HeightFieldShape::setLocalScaling(const Vector3& scaling) {
|
||||||
CollisionShape::setLocalScaling(scaling);
|
CollisionShape::setLocalScaling(scaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the vertex (local-coordinates) of the height field at a given (x,y) position
|
|
||||||
inline Vector3 HeightFieldShape::getVertexAt(int x, int y) const {
|
|
||||||
|
|
||||||
// Get the height value
|
|
||||||
const decimal height = getHeightAt(x, y);
|
|
||||||
|
|
||||||
// Height values origin
|
|
||||||
const decimal heightOrigin = -(mMaxHeight - mMinHeight) * decimal(0.5) - mMinHeight;
|
|
||||||
|
|
||||||
Vector3 vertex;
|
|
||||||
switch (mUpAxis) {
|
|
||||||
case 0: vertex = Vector3(heightOrigin + height, -mWidth * decimal(0.5) + x, -mLength * decimal(0.5) + y);
|
|
||||||
break;
|
|
||||||
case 1: vertex = Vector3(-mWidth * decimal(0.5) + x, heightOrigin + height, -mLength * decimal(0.5) + y);
|
|
||||||
break;
|
|
||||||
case 2: vertex = Vector3(-mWidth * decimal(0.5) + x, -mLength * decimal(0.5) + y, heightOrigin + height);
|
|
||||||
break;
|
|
||||||
default: assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(mAABB.contains(vertex));
|
|
||||||
|
|
||||||
return vertex * mScaling;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the height of a given (x,y) point in the height field
|
// Return the height of a given (x,y) point in the height field
|
||||||
inline decimal HeightFieldShape::getHeightAt(int x, int y) const {
|
inline decimal HeightFieldShape::getHeightAt(int x, int y) const {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user