//init the rigid bodies to it's first frame configuration void dSolverNode::initRigidBodies(MPlugArray &rbConnections) { for(size_t i = 0; i < rbConnections.length(); ++i) { MObject node = rbConnections[i].node(); MFnDependencyNode fnNode(node); if(fnNode.typeId() == rigidBodyNode::typeId) { initRigidBody(node); } else if(fnNode.typeId() == rigidBodyArrayNode::typeId) { initRigidBodyArray(node); } } }
tgModel* tgRodInfo::createModel(tgWorld& world) { // @todo: handle tags -> model // @todo: check to make sure the rigidBody has been built // @todo: Do we need to use the group here? // Just in case it hasn't been done already... initRigidBody(world); #if (0) std::cout << "creating rod with tags " << getTags() << std::endl; #endif tgRod* rod = new tgRod(getRigidBody(), getTags(), getLength()); return rod; }
Platform::Platform(btVector3 startPos) { ShapeHandler *sh = ShapeHandler::getHandler(); if (!sh->hasShape("platform")) { // Load in the shapes to be used sh->addMesh("platform", "platform.stl", false); } btCollisionShape *platformShape = sh->getShape("platform"); this->openglObject = sh->getMesh("platform")->openglobj; float color[4] = {0.3, 0.3, 0.3, 1}; this->openglObject->setColor(color); // Set up our beginning transform //btQuaternion rot(0,0,0,1); btTransform trans; trans.setIdentity(); trans.setOrigin(startPos); trans.setRotation(btQuaternion(btVector3(0, 1, 0), -90.0/57.0)); initRigidBody(0.0, platformShape, trans); }