/** * addCollisionMap */ rigidbody* PhysicsManagerImpl::addCollisionMap(meshscenenode * node) { if(node == 0) return 0; // Avoid crashing here in the library // Bullet specific for now node->grab(); btTriangleMesh * mesh = getTriangleMesh(node); if(mesh == 0) // Looks like there was no mesh data - or something went wrong? { node->drop(); return 0; } map = new mapshape(mesh, false, true); // Init pos - Irrlicht specific btTransform trans; trans.setIdentity(); //trans.setOrigin(vector3dfToBtVector3(node->getAbsolutePosition())); trans.setOrigin(btVector3(0,0,0)); // Default motion state btDefaultMotionState * motionstate = new btDefaultMotionState(trans); // Local Inertia btVector3 LocalInertia(0,0,0); // map->calculateLocalInertia(0.0, LocalInertia); rigidbody * b = new rigidbody(0.0f, motionstate, map, LocalInertia); b->setUserPointer((void*)node); b->setGravity(btVector3(0,0,0)); b->setCollisionFlags(1); // Static object getWorld()->addRigidBody(b); collisions.push_back(b); return b; }
ContextMenu* InvoluteGearGUIStateNode::getContextMenu() const { m_involuteGearContextMenu->setInvoluteGear(m_involuteGear, getTriangleMesh()); return m_involuteGearContextMenu; }
ContextMenu* SimpleGearGUIStateNode::getContextMenu() const { m_simpleGearContextMenu->setSimpleGear(m_simpleGear, getTriangleMesh()); return m_simpleGearContextMenu; }
ContextMenu* DiscGUIStateNode::getContextMenu() const { m_discContextMenu->setDisc(m_surfaceOfRevolution, getTriangleMesh()); return m_discContextMenu; }