CharController(const btVector3 &pos, btCollisionShape *shape, btScalar mass) { // set defaults btVector3 localIntertia = btVector3(1, 0, 1); //shape->calculateLocalInertia(mass, localIntertia); btTransform startTransform = btTransform::getIdentity(); startTransform.setOrigin(pos); btDefaultMotionState *state = new btDefaultMotionState(startTransform); body = new btRigidBody(mass, state, shape, localIntertia); body->setFriction(0.5f); }
PhysicsObject(btDiscreteDynamicsWorld & world, const T & shape, btScalar mass, btVector3 velocity, const btTransform & transform, GameBall * ptrBall): _shape(shape), _motionState(transform), _rigidBody(mass, &_motionState, &_shape), _ptrBall(ptrBall) { // TODO angular velocity ? _rigidBody.setLinearVelocity(velocity); _rigidBody.setDamping(0.1, 0.1); _rigidBody.setRestitution(0.7); _rigidBody.setFriction(0.1); // TODO _rigidBody.setRollingFriction(0.01); world.addRigidBody(&_rigidBody); }