Set color of individual Rigid Bodies in ExampleBrowser
Posted: Wed Mar 15, 2017 9:40 pm
Hey, I'm trying to edit an example in the Bullet ExampleBrowser, but I want to set the color for each individual rigid body. My efforts are in vain, however, as none of my objects are rendering. I would like to give an example of what I am doing for the ground texture and let me know if this is sound.
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-50,0));
btScalar mass(0.);
btRigidBody* ground = createRigidBody(mass, groundTransform, groundShape);
m_guiHelper->createRigidBodyGraphicsObject(ground, btVector4(0, 1, 0, 1));
I'm assuming after creating the rigid body, all I have to do is add that last line which I thought would render the object with the specified color (in this case green).
Thanks for any input.
btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-50,0));
btScalar mass(0.);
btRigidBody* ground = createRigidBody(mass, groundTransform, groundShape);
m_guiHelper->createRigidBodyGraphicsObject(ground, btVector4(0, 1, 0, 1));
I'm assuming after creating the rigid body, all I have to do is add that last line which I thought would render the object with the specified color (in this case green).
Thanks for any input.