Working on demo scenes in testbed application

This commit is contained in:
Daniel Chappuis 2016-02-14 19:36:56 +01:00
parent eeb1052833
commit 32bee688be
12 changed files with 79781 additions and 7174 deletions

View File

@ -30,25 +30,25 @@ using namespace reactphysics3d;
// Constructor
/**
* @param nbWidthGridPoints Number of grid points along the width of the height field
* @param nbLengthGridPoints Number of grid points along the length of the height field
* @param nbGridColumns Number of columns in the grid of the height field
* @param nbGridRows Number of rows in the grid of the height field
* @param minHeight Minimum height value of the height field
* @param maxHeight Maximum height value of the height field
* @param heightFieldData Pointer to the first height value data
* @param heightFieldData Pointer to the first height value data (note that values are shared and not copied)
* @param dataType Data type for the height values (int, float, double)
* @param upAxis Integer representing the up axis direction (0 for x, 1 for y and 2 for z)
* @param integerHeightScale Scaling factor used to scale the height values
* @param integerHeightScale Scaling factor used to scale the height values (only when height values type is integer)
*/
HeightFieldShape::HeightFieldShape(int nbWidthGridPoints, int nbLengthGridPoints, decimal minHeight, decimal maxHeight,
HeightFieldShape::HeightFieldShape(int nbGridColumns, int nbGridRows, decimal minHeight, decimal maxHeight,
const void* heightFieldData, HeightDataType dataType, int upAxis,
decimal integerHeightScale)
: ConcaveShape(HEIGHTFIELD), mNbWidthGridPoints(nbWidthGridPoints), mNbLengthGridPoints(nbLengthGridPoints),
mWidth(nbWidthGridPoints - 1), mLength(nbLengthGridPoints - 1), mMinHeight(minHeight),
: ConcaveShape(HEIGHTFIELD), mNbColumns(nbGridColumns), mNbRows(nbGridRows),
mWidth(nbGridColumns - 1), mLength(nbGridRows - 1), mMinHeight(minHeight),
mMaxHeight(maxHeight), mUpAxis(upAxis), mIntegerHeightScale(integerHeightScale),
mHeightDataType(dataType) {
assert(nbWidthGridPoints >= 2);
assert(nbLengthGridPoints >= 2);
assert(nbGridColumns >= 2);
assert(nbGridRows >= 2);
assert(mWidth >= 1);
assert(mLength >= 1);
assert(minHeight <= maxHeight);
@ -108,27 +108,27 @@ void HeightFieldShape::testAllTriangles(TriangleCallback& callback, const AABB&
// Compute the starting and ending coords of the sub-grid according to the up axis
int iMin, iMax, jMin, jMax;
switch(mUpAxis) {
case 0 : iMin = clamp(minGridCoords[1], 0, mNbWidthGridPoints - 1);
iMax = clamp(maxGridCoords[1], 0, mNbWidthGridPoints - 1);
jMin = clamp(minGridCoords[2], 0, mNbLengthGridPoints - 1);
jMax = clamp(maxGridCoords[2], 0, mNbLengthGridPoints - 1);
case 0 : iMin = clamp(minGridCoords[1], 0, mNbColumns - 1);
iMax = clamp(maxGridCoords[1], 0, mNbColumns - 1);
jMin = clamp(minGridCoords[2], 0, mNbRows - 1);
jMax = clamp(maxGridCoords[2], 0, mNbRows - 1);
break;
case 1 : iMin = clamp(minGridCoords[0], 0, mNbWidthGridPoints - 1);
iMax = clamp(maxGridCoords[0], 0, mNbWidthGridPoints - 1);
jMin = clamp(minGridCoords[2], 0, mNbLengthGridPoints - 1);
jMax = clamp(maxGridCoords[2], 0, mNbLengthGridPoints - 1);
case 1 : iMin = clamp(minGridCoords[0], 0, mNbColumns - 1);
iMax = clamp(maxGridCoords[0], 0, mNbColumns - 1);
jMin = clamp(minGridCoords[2], 0, mNbRows - 1);
jMax = clamp(maxGridCoords[2], 0, mNbRows - 1);
break;
case 2 : iMin = clamp(minGridCoords[0], 0, mNbWidthGridPoints - 1);
iMax = clamp(maxGridCoords[0], 0, mNbWidthGridPoints - 1);
jMin = clamp(minGridCoords[1], 0, mNbLengthGridPoints - 1);
jMax = clamp(maxGridCoords[1], 0, mNbLengthGridPoints - 1);
case 2 : iMin = clamp(minGridCoords[0], 0, mNbColumns - 1);
iMax = clamp(maxGridCoords[0], 0, mNbColumns - 1);
jMin = clamp(minGridCoords[1], 0, mNbRows - 1);
jMax = clamp(maxGridCoords[1], 0, mNbRows - 1);
break;
}
assert(iMin >= 0 && iMin < mNbWidthGridPoints);
assert(iMax >= 0 && iMax < mNbWidthGridPoints);
assert(jMin >= 0 && jMin < mNbLengthGridPoints);
assert(jMax >= 0 && jMax < mNbLengthGridPoints);
assert(iMin >= 0 && iMin < mNbColumns);
assert(iMax >= 0 && iMax < mNbColumns);
assert(jMin >= 0 && jMin < mNbRows);
assert(jMax >= 0 && jMax < mNbRows);
// For each sub-grid points (except the last ones one each dimension)
for (int i = iMin; i < iMax; i++) {

View File

@ -67,14 +67,17 @@ class TriangleOverlapCallback : public TriangleCallback {
virtual void testTriangle(const Vector3* trianglePoints);
};
// TODO : Implement raycasting for this shape
// TODO : Implement smooth collision mesh for this shape
// Class HeightFieldShape
/**
* This class represents a static height field that can be used to represent
* a terrain.
* a terrain. The height field is made of a grid with rows and columns with a
* height value at each grid point. Note that the height values are not copied into the shape
* but are shared instead. The height values can be of type integer, float or double.
* When creating a HeightFieldShape, you need to specify the minimum and maximum height value of
* your height field. Note that the HeightFieldShape will be re-centered based on its AABB. It means
* that for instance, if the minimum height value is -200 and the maximum value is 400, the final
* minimum height of the field in the simulation will be -300 and the maximum height will be 300.
*/
class HeightFieldShape : public ConcaveShape {
@ -87,11 +90,11 @@ class HeightFieldShape : public ConcaveShape {
// -------------------- Attributes -------------------- //
/// Number of grid points in the width dimension
int mNbWidthGridPoints;
/// Number of columns in the grid of the height field
int mNbColumns;
/// Number of grid points in the length dimension
int mNbLengthGridPoints;
/// Number of rows in the grid of the height field
int mNbRows;
/// Height field width
decimal mWidth;
@ -164,6 +167,15 @@ class HeightFieldShape : public ConcaveShape {
/// Destructor
~HeightFieldShape();
/// Return the number of rows in the height field
int getNbRows() const;
/// Return the number of columns in the height field
int getNbColumns() const;
/// Return the type of height value in the height field
HeightDataType getHeightDataType() const;
/// Return the local bounds of the shape in x, y and z directions.
virtual void getLocalBounds(Vector3& min, Vector3& max) const;
@ -182,6 +194,21 @@ class HeightFieldShape : public ConcaveShape {
friend class ConcaveMeshRaycastCallback;
};
// Return the number of rows in the height field
inline int HeightFieldShape::getNbRows() const {
return mNbRows;
}
// Return the number of columns in the height field
inline int HeightFieldShape::getNbColumns() const {
return mNbColumns;
}
// Return the type of height value in the height field
inline HeightFieldShape::HeightDataType HeightFieldShape::getHeightDataType() const {
return mHeightDataType;
}
// Return the number of bytes used by the collision shape
inline size_t HeightFieldShape::getSizeInBytes() const {
return sizeof(HeightFieldShape);
@ -221,9 +248,9 @@ inline Vector3 HeightFieldShape::getVertexAt(int x, int y) const {
inline decimal HeightFieldShape::getHeightAt(int x, int y) const {
switch(mHeightDataType) {
case HEIGHT_FLOAT_TYPE : return ((float*)mHeightFieldData)[y * mNbWidthGridPoints + x];
case HEIGHT_DOUBLE_TYPE : return ((double*)mHeightFieldData)[y * mNbWidthGridPoints + x];
case HEIGHT_INT_TYPE : return ((int*)mHeightFieldData)[y * mNbWidthGridPoints + x] * mIntegerHeightScale;
case HEIGHT_FLOAT_TYPE : return ((float*)mHeightFieldData)[y * mNbColumns + x];
case HEIGHT_DOUBLE_TYPE : return ((double*)mHeightFieldData)[y * mNbColumns + x];
case HEIGHT_INT_TYPE : return ((int*)mHeightFieldData)[y * mNbColumns + x] * mIntegerHeightScale;
default: assert(false);
}
}

View File

@ -75,6 +75,8 @@ SET(COMMON_SOURCES
common/PhysicsObject.cpp
common/VisualContactPoint.h
common/VisualContactPoint.cpp
common/PerlinNoise.h
common/PerlinNoise.cpp
)
# Examples scenes source files

View File

@ -49,7 +49,7 @@ HeightField::HeightField(const openglframework::Vector3 &position,
// Create the collision shape for the rigid body (convex mesh shape) and
// do not forget to delete it at the end
mHeightFieldShape = new rp3d::HeightFieldShape(NB_POINTS_WIDTH, NB_POINTS_LENGTH, mMinHeight, mMaxHeight,
mHeightData, rp3d::HeightFieldShape::HEIGHT_FLOAT_TYPE);
mHeightData, rp3d::HeightFieldShape::HEIGHT_INT_TYPE);
// Initial position and orientation of the rigid body
rp3d::Vector3 initPosition(position.x, position.y, position.z);
@ -92,7 +92,7 @@ HeightField::HeightField(const openglframework::Vector3 &position, float mass,
// Create the collision shape for the rigid body (convex mesh shape) and
// do not forget to delete it at the end
mHeightFieldShape = new rp3d::HeightFieldShape(NB_POINTS_WIDTH, NB_POINTS_LENGTH, mMinHeight, mMaxHeight,
mHeightData, rp3d::HeightFieldShape::HEIGHT_FLOAT_TYPE);
mHeightData, rp3d::HeightFieldShape::HEIGHT_INT_TYPE);
// Initial position and orientation of the rigid body
rp3d::Vector3 initPosition(position.x, position.y, position.z);
@ -189,15 +189,15 @@ void HeightField::render(openglframework::Shader& shader,
// Compute the heights of the height field
void HeightField::generateHeightField() {
double persistence = 6;
double frequency = 0.13;
double amplitude = 18;
double persistence = 9;
double frequency = 0.28;
double amplitude = 12;
int octaves = 1;
int randomseed = 779;
int randomseed = 23;
PerlinNoise perlinNoise(persistence, frequency, amplitude, octaves, randomseed);
mMinHeight = 0;
mMaxHeight = 5;
mMaxHeight = 0;
float width = (NB_POINTS_WIDTH - 1);
float length = (NB_POINTS_LENGTH - 1);
@ -214,8 +214,8 @@ void HeightField::generateHeightField() {
mMaxHeight = mHeightData[arrayIndex] ;
}
if (mHeightData[arrayIndex] > mMaxHeight) mMaxHeight = mHeightData[arrayIndex] ;
if (mHeightData[arrayIndex] < mMinHeight) mMinHeight = mHeightData[arrayIndex] ;
if (mHeightData[arrayIndex] > mMaxHeight) mMaxHeight = mHeightData[arrayIndex] ;
if (mHeightData[arrayIndex] < mMinHeight) mMinHeight = mHeightData[arrayIndex] ;
}
}
}
@ -226,8 +226,6 @@ void HeightField::generateGraphicsMesh() {
std::vector<uint> indices;
int vertexId = 0;
float horizontalScale = 1.0f;
for (int i=0; i<NB_POINTS_WIDTH; i++) {
for (int j=0; j<NB_POINTS_LENGTH; j++) {
@ -235,9 +233,6 @@ void HeightField::generateGraphicsMesh() {
float height = originHeight + mHeightData[j * NB_POINTS_WIDTH + i];
openglframework::Vector3 vertex(-(NB_POINTS_WIDTH - 1) * 0.5f + i, height, -(NB_POINTS_LENGTH - 1) * 0.5f + j);
vertex.x *= horizontalScale;
vertex.z *= horizontalScale;
mVertices.push_back(vertex);
// Triangle indices

View File

@ -43,7 +43,7 @@ class HeightField : public openglframework::Mesh, public PhysicsObject {
// -------------------- Attributes -------------------- //
/// Height field data
float mHeightData[NB_POINTS_WIDTH * NB_POINTS_LENGTH];
int mHeightData[NB_POINTS_WIDTH * NB_POINTS_LENGTH];
/// Previous transform (for interpolation)
rp3d::Transform mPreviousTransform;

File diff suppressed because it is too large Load Diff

View File

@ -224,7 +224,9 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
mConvexMeshes.push_back(mesh);
}
// Create the floor
// ---------- Create the floor ---------
openglframework::Vector3 floorPosition(0, 0, 0);
mFloor = new Box(FLOOR_SIZE, floorPosition, FLOOR_MASS, mDynamicsWorld);
@ -239,6 +241,30 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
rp3d::Material& material = mFloor->getRigidBody()->getMaterial();
material.setBounciness(rp3d::decimal(0.2));
// ---------- Create the triangular mesh ---------- //
/*
// Position
openglframework::Vector3 position(0, 0, 0);
rp3d::decimal mass = 1.0;
// Create a convex mesh and a corresponding rigid in the dynamics world
mConcaveMesh = new ConcaveMesh(position, mass, mDynamicsWorld, meshFolderPath);
// Set the mesh as beeing static
mConcaveMesh->getRigidBody()->setType(rp3d::STATIC);
// Set the box color
mConcaveMesh->setColor(mDemoColors[0]);
mConcaveMesh->setSleepingColor(mRedColorDemo);
// Change the material properties of the rigid body
rp3d::Material& material = mConcaveMesh->getRigidBody()->getMaterial();
material.setBounciness(rp3d::decimal(0.2));
material.setFrictionCoefficient(0.1);
*/
// Get the physics engine parameters
mEngineSettings.isGravityEnabled = mDynamicsWorld->isGravityEnabled();
rp3d::Vector3 gravityVector = mDynamicsWorld->getGravity();
@ -328,10 +354,14 @@ CollisionShapesScene::~CollisionShapesScene() {
// Destroy the rigid body of the floor
mDynamicsWorld->destroyRigidBody(mFloor->getRigidBody());
//mDynamicsWorld->destroyRigidBody(mConcaveMesh->getRigidBody());
// Destroy the floor
delete mFloor;
// Destroy the convex mesh
//delete mConcaveMesh;
// Destroy the dynamics world
delete mDynamicsWorld;
}
@ -411,6 +441,8 @@ void CollisionShapesScene::update() {
(*it)->updateTransform(mInterpolationFactor);
}
//mConcaveMesh->updateTransform(mInterpolationFactor);
mFloor->updateTransform(mInterpolationFactor);
}
@ -461,6 +493,8 @@ void CollisionShapesScene::renderSinglePass(openglframework::Shader& shader,
// Render the floor
mFloor->render(shader, worldToCameraMatrix);
//mConcaveMesh->render(shader, worldToCameraMatrix);
// Unbind the shader
shader.unbind();
}

View File

@ -36,6 +36,7 @@
#include "Cylinder.h"
#include "Capsule.h"
#include "ConvexMesh.h"
#include "ConcaveMesh.h"
#include "Dumbbell.h"
#include "VisualContactPoint.h"
#include "../common/Viewer.h"
@ -45,13 +46,13 @@ namespace collisionshapesscene {
// Constants
const float SCENE_RADIUS = 30.0f;
const int NB_BOXES = 4;
const int NB_CUBES = 6;
const int NB_CONES = 6;
const int NB_BOXES = 5;
const int NB_CUBES = 5;
const int NB_CONES = 5;
const int NB_CYLINDERS = 5;
const int NB_CAPSULES = 4;
const int NB_MESHES = 5;
const int NB_COMPOUND_SHAPES = 4;
const int NB_CAPSULES = 5;
const int NB_MESHES = 3;
const int NB_COMPOUND_SHAPES = 3;
const openglframework::Vector3 BOX_SIZE(2, 2, 2);
const float SPHERE_RADIUS = 1.5f;
const float CONE_RADIUS = 2.0f;
@ -93,6 +94,9 @@ class CollisionShapesScene : public SceneDemo {
/// All the dumbbell of the scene
std::vector<Dumbbell*> mDumbbells;
/// Concave triangles mesh
ConcaveMesh* mConcaveMesh;
/// Box for the floor
Box* mFloor;

View File

@ -52,21 +52,21 @@ ConcaveMeshScene::ConcaveMeshScene(const std::string& name)
// Set the number of iterations of the constraint solver
mDynamicsWorld->setNbIterationsVelocitySolver(15);
// ---------- Create the sphere ----------- //
// ---------- Create the cube ----------- //
// Position
rp3d::decimal radius = 2.0;
openglframework::Vector3 spherePos(0, 10, 0);
openglframework::Vector3 spherePos(15, 10, 0);
// Create a sphere and a corresponding rigid in the dynamics world
mSphere = new Sphere(radius, spherePos , 1.0, mDynamicsWorld, meshFolderPath);
mBox = new Box(Vector3(3, 3, 3), spherePos, 80.1, mDynamicsWorld);
// Set the sphere color
mSphere->setColor(mDemoColors[1]);
mSphere->setSleepingColor(mRedColorDemo);
mBox->setColor(mDemoColors[1]);
mBox->setSleepingColor(mRedColorDemo);
// Change the material properties of the rigid body
rp3d::Material& sphereMat = mSphere->getRigidBody()->getMaterial();
rp3d::Material& sphereMat = mBox->getRigidBody()->getMaterial();
sphereMat.setBounciness(rp3d::decimal(0.2));
// ---------- Create the triangular mesh ---------- //
@ -88,6 +88,7 @@ ConcaveMeshScene::ConcaveMeshScene(const std::string& name)
// Change the material properties of the rigid body
rp3d::Material& material = mConcaveMesh->getRigidBody()->getMaterial();
material.setBounciness(rp3d::decimal(0.2));
material.setFrictionCoefficient(0.1);
// Get the physics engine parameters
mEngineSettings.isGravityEnabled = mDynamicsWorld->isGravityEnabled();
@ -104,11 +105,11 @@ ConcaveMeshScene::ConcaveMeshScene(const std::string& name)
// Destructor
ConcaveMeshScene::~ConcaveMeshScene() {
mDynamicsWorld->destroyRigidBody(mSphere->getRigidBody());
mDynamicsWorld->destroyRigidBody(mBox->getRigidBody());
// Destroy the corresponding rigid body from the dynamics world
mDynamicsWorld->destroyRigidBody(mConcaveMesh->getRigidBody());
delete mSphere;
delete mBox;
// Destroy the convex mesh
delete mConcaveMesh;
@ -143,7 +144,7 @@ void ConcaveMeshScene::update() {
// Update the transform used for the rendering
mConcaveMesh->updateTransform(mInterpolationFactor);
mSphere->updateTransform(mInterpolationFactor);
mBox->updateTransform(mInterpolationFactor);
}
// Render the scene in a single pass
@ -153,7 +154,7 @@ void ConcaveMeshScene::renderSinglePass(Shader& shader, const openglframework::M
shader.bind();
mConcaveMesh->render(shader, worldToCameraMatrix);
mSphere->render(shader, worldToCameraMatrix);
mBox->render(shader, worldToCameraMatrix);
// Unbind the shader
shader.unbind();
@ -163,9 +164,13 @@ void ConcaveMeshScene::renderSinglePass(Shader& shader, const openglframework::M
void ConcaveMeshScene::reset() {
// Reset the transform
mConcaveMesh->resetTransform(rp3d::Transform::identity());
rp3d::Quaternion initOrientation(0, 0, 3.141/12);
rp3d::Quaternion initOrientation2(0, 0, 3.141/13);
//rp3d::Transform transform(rp3d::Vector3(0, 0, 0), initOrientation);
rp3d::Transform transform(rp3d::Vector3(0, 0, 0), initOrientation2);
mConcaveMesh->resetTransform(transform);
rp3d::Vector3 spherePos(0, 15, 0);
rp3d::Transform sphereTransform(spherePos, rp3d::Quaternion::identity());
mSphere->resetTransform(sphereTransform);
rp3d::Vector3 spherePos(2, 15, 0);
rp3d::Transform sphereTransform(spherePos, initOrientation2);
mBox->resetTransform(sphereTransform);
}

View File

@ -32,7 +32,7 @@
#include "Box.h"
#include "SceneDemo.h"
#include "ConcaveMesh.h"
#include "Sphere.h"
#include "Box.h"
namespace trianglemeshscene {
@ -46,7 +46,7 @@ class ConcaveMeshScene : public SceneDemo {
// -------------------- Attributes -------------------- //
Sphere* mSphere;
Box* mBox;
/// Concave triangles mesh
ConcaveMesh* mConcaveMesh;

View File

@ -49,21 +49,25 @@ HeightFieldScene::HeightFieldScene(const std::string& name) : SceneDemo(name, SC
// Set the number of iterations of the constraint solver
mDynamicsWorld->setNbIterationsVelocitySolver(15);
// ---------- Create the cube ----------- //
// ---------- Create the boxes ----------- //
// Position
openglframework::Vector3 spherePos(15, 10, 0);
// For each box
for (int i=0; i<NB_BOXES; i++) {
// Create a sphere and a corresponding rigid in the dynamics world
mBox = new Box(Vector3(3, 3, 3), spherePos, 80.1, mDynamicsWorld);
// Position
openglframework::Vector3 spherePos(15, 10, 0);
// Set the sphere color
mBox->setColor(mDemoColors[1]);
mBox->setSleepingColor(mRedColorDemo);
// Create a sphere and a corresponding rigid in the dynamics world
mBoxes[i] = new Box(Vector3(3, 3, 3), spherePos, 80.1, mDynamicsWorld);
// Change the material properties of the rigid body
rp3d::Material& sphereMat = mBox->getRigidBody()->getMaterial();
sphereMat.setBounciness(rp3d::decimal(0.2));
// Set the sphere color
mBoxes[i]->setColor(mDemoColors[1]);
mBoxes[i]->setSleepingColor(mRedColorDemo);
// Change the material properties of the rigid body
rp3d::Material& sphereMat = mBoxes[i]->getRigidBody()->getMaterial();
sphereMat.setBounciness(rp3d::decimal(0.2));
}
// ---------- Create the height field ---------- //
@ -101,11 +105,15 @@ HeightFieldScene::HeightFieldScene(const std::string& name) : SceneDemo(name, SC
// Destructor
HeightFieldScene::~HeightFieldScene() {
mDynamicsWorld->destroyRigidBody(mBox->getRigidBody());
// Destroy the corresponding rigid body from the dynamics world
for (int i=0; i<NB_BOXES; i++) {
mDynamicsWorld->destroyRigidBody(mBoxes[i]->getRigidBody());
}
mDynamicsWorld->destroyRigidBody(mHeightField->getRigidBody());
delete mBox;
for (int i=0; i<NB_BOXES; i++) {
delete mBoxes[i];
}
// Destroy the convex mesh
delete mHeightField;
@ -140,7 +148,10 @@ void HeightFieldScene::update() {
// Update the transform used for the rendering
mHeightField->updateTransform(mInterpolationFactor);
mBox->updateTransform(mInterpolationFactor);
for (int i=0; i<NB_BOXES; i++) {
mBoxes[i]->updateTransform(mInterpolationFactor);
}
}
// Render the scene in a single pass
@ -150,7 +161,10 @@ void HeightFieldScene::renderSinglePass(Shader& shader, const openglframework::M
shader.bind();
mHeightField->render(shader, worldToCameraMatrix);
mBox->render(shader, worldToCameraMatrix);
for (int i=0; i<NB_BOXES; i++) {
mBoxes[i]->render(shader, worldToCameraMatrix);
}
// Unbind the shader
shader.unbind();
@ -164,7 +178,11 @@ void HeightFieldScene::reset() {
rp3d::Transform transform(rp3d::Vector3(0, 0, 0), initOrientation);
mHeightField->resetTransform(transform);
rp3d::Vector3 spherePos(0, 13, 0);
rp3d::Transform sphereTransform(spherePos, initOrientation);
mBox->resetTransform(sphereTransform);
float heightFieldWidth = 10.0f;
float stepDist = heightFieldWidth / (NB_BOXES + 1);
for (int i=0; i<NB_BOXES; i++) {
rp3d::Vector3 spherePos(-heightFieldWidth * 0.5f + i * stepDist , 14 + 6.0f * i, -heightFieldWidth * 0.5f + i * stepDist);
rp3d::Transform sphereTransform(spherePos, initOrientation);
mBoxes[i]->resetTransform(sphereTransform);
}
}

View File

@ -41,11 +41,13 @@ const float SCENE_RADIUS = 30.0f;
// Class HeightFieldScene
class HeightFieldScene : public SceneDemo {
static const int NB_BOXES = 10;
protected :
// -------------------- Attributes -------------------- //
Box* mBox;
Box* mBoxes[NB_BOXES];
/// Height field
HeightField* mHeightField;