From e530a1a7cca5cd49355d105b7ef9c15887f63225 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Mon, 21 Mar 2016 21:55:02 +0100 Subject: [PATCH] Add rolling resistance to shapes in collision shapes scene in testbed application --- .../collisionshapes/CollisionShapesScene.cpp | 15 +++++++++++++-- .../scenes/collisionshapes/CollisionShapesScene.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/testbed/scenes/collisionshapes/CollisionShapesScene.cpp b/testbed/scenes/collisionshapes/CollisionShapesScene.cpp index 7abbf702..f6fda6f2 100644 --- a/testbed/scenes/collisionshapes/CollisionShapesScene.cpp +++ b/testbed/scenes/collisionshapes/CollisionShapesScene.cpp @@ -101,7 +101,7 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) } // Create all the spheres of the scene - for (int i=0; igetRigidBody()->getMaterial().setRollingResistance(0.08); + // Set the box color sphere->setColor(mDemoColors[i % mNbDemoColors]); 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, meshFolderPath); + // Add some rolling resistance + cone->getRigidBody()->getMaterial().setRollingResistance(0.08); + // Set the box color cone->setColor(mDemoColors[i % mNbDemoColors]); cone->setSleepingColor(mRedColorDemo); @@ -163,6 +169,9 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) Cylinder* cylinder = new Cylinder(CYLINDER_RADIUS, CYLINDER_HEIGHT, position , CYLINDER_MASS, mDynamicsWorld, meshFolderPath); + // Add some rolling resistance + cylinder->getRigidBody()->getMaterial().setRollingResistance(0.08); + // Set the box color cylinder->setColor(mDemoColors[i % mNbDemoColors]); cylinder->setSleepingColor(mRedColorDemo); @@ -188,6 +197,8 @@ CollisionShapesScene::CollisionShapesScene(const std::string& name) Capsule* capsule = new Capsule(CAPSULE_RADIUS, CAPSULE_HEIGHT, position , CAPSULE_MASS, mDynamicsWorld, meshFolderPath); + capsule->getRigidBody()->getMaterial().setRollingResistance(0.08); + // Set the box color capsule->setColor(mDemoColors[i % mNbDemoColors]); capsule->setSleepingColor(mRedColorDemo); @@ -540,7 +551,7 @@ void CollisionShapesScene::reset() { } // Create all the spheres of the scene - for (int i=0; i