Add rolling resistance to shapes in collision shapes scene in testbed application
This commit is contained in:
parent
67334b1bd3
commit
e530a1a7cc
|
@ -101,7 +101,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create all the spheres of the scene
|
// Create all the spheres of the scene
|
||||||
for (int i=0; i<NB_CUBES; i++) {
|
for (int i=0; i<NB_SPHERES; i++) {
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
float angle = i * 35.0f;
|
float angle = i * 35.0f;
|
||||||
|
@ -113,6 +113,9 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
||||||
Sphere* sphere = new Sphere(SPHERE_RADIUS, position , BOX_MASS, mDynamicsWorld,
|
Sphere* sphere = new Sphere(SPHERE_RADIUS, position , BOX_MASS, mDynamicsWorld,
|
||||||
meshFolderPath);
|
meshFolderPath);
|
||||||
|
|
||||||
|
// Add some rolling resistance
|
||||||
|
sphere->getRigidBody()->getMaterial().setRollingResistance(0.08);
|
||||||
|
|
||||||
// Set the box color
|
// Set the box color
|
||||||
sphere->setColor(mDemoColors[i % mNbDemoColors]);
|
sphere->setColor(mDemoColors[i % mNbDemoColors]);
|
||||||
sphere->setSleepingColor(mRedColorDemo);
|
sphere->setSleepingColor(mRedColorDemo);
|
||||||
|
@ -138,6 +141,9 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
||||||
Cone* cone = new Cone(CONE_RADIUS, CONE_HEIGHT, position, CONE_MASS, mDynamicsWorld,
|
Cone* cone = new Cone(CONE_RADIUS, CONE_HEIGHT, position, CONE_MASS, mDynamicsWorld,
|
||||||
meshFolderPath);
|
meshFolderPath);
|
||||||
|
|
||||||
|
// Add some rolling resistance
|
||||||
|
cone->getRigidBody()->getMaterial().setRollingResistance(0.08);
|
||||||
|
|
||||||
// Set the box color
|
// Set the box color
|
||||||
cone->setColor(mDemoColors[i % mNbDemoColors]);
|
cone->setColor(mDemoColors[i % mNbDemoColors]);
|
||||||
cone->setSleepingColor(mRedColorDemo);
|
cone->setSleepingColor(mRedColorDemo);
|
||||||
|
@ -163,6 +169,9 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
||||||
Cylinder* cylinder = new Cylinder(CYLINDER_RADIUS, CYLINDER_HEIGHT, position ,
|
Cylinder* cylinder = new Cylinder(CYLINDER_RADIUS, CYLINDER_HEIGHT, position ,
|
||||||
CYLINDER_MASS, mDynamicsWorld, meshFolderPath);
|
CYLINDER_MASS, mDynamicsWorld, meshFolderPath);
|
||||||
|
|
||||||
|
// Add some rolling resistance
|
||||||
|
cylinder->getRigidBody()->getMaterial().setRollingResistance(0.08);
|
||||||
|
|
||||||
// Set the box color
|
// Set the box color
|
||||||
cylinder->setColor(mDemoColors[i % mNbDemoColors]);
|
cylinder->setColor(mDemoColors[i % mNbDemoColors]);
|
||||||
cylinder->setSleepingColor(mRedColorDemo);
|
cylinder->setSleepingColor(mRedColorDemo);
|
||||||
|
@ -188,6 +197,8 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name)
|
||||||
Capsule* capsule = new Capsule(CAPSULE_RADIUS, CAPSULE_HEIGHT, position ,
|
Capsule* capsule = new Capsule(CAPSULE_RADIUS, CAPSULE_HEIGHT, position ,
|
||||||
CAPSULE_MASS, mDynamicsWorld, meshFolderPath);
|
CAPSULE_MASS, mDynamicsWorld, meshFolderPath);
|
||||||
|
|
||||||
|
capsule->getRigidBody()->getMaterial().setRollingResistance(0.08);
|
||||||
|
|
||||||
// Set the box color
|
// Set the box color
|
||||||
capsule->setColor(mDemoColors[i % mNbDemoColors]);
|
capsule->setColor(mDemoColors[i % mNbDemoColors]);
|
||||||
capsule->setSleepingColor(mRedColorDemo);
|
capsule->setSleepingColor(mRedColorDemo);
|
||||||
|
@ -540,7 +551,7 @@ void CollisionShapesScene::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create all the spheres of the scene
|
// Create all the spheres of the scene
|
||||||
for (int i=0; i<NB_CUBES; i++) {
|
for (int i=0; i<NB_SPHERES; i++) {
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
float angle = i * 35.0f;
|
float angle = i * 35.0f;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace collisionshapesscene {
|
||||||
// Constants
|
// Constants
|
||||||
const float SCENE_RADIUS = 30.0f;
|
const float SCENE_RADIUS = 30.0f;
|
||||||
const int NB_BOXES = 5;
|
const int NB_BOXES = 5;
|
||||||
const int NB_CUBES = 5;
|
const int NB_SPHERES = 5;
|
||||||
const int NB_CONES = 5;
|
const int NB_CONES = 5;
|
||||||
const int NB_CYLINDERS = 5;
|
const int NB_CYLINDERS = 5;
|
||||||
const int NB_CAPSULES = 5;
|
const int NB_CAPSULES = 5;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user