TheNinja
23-12-2007 19:05:53
When I'm using the setPosition or the setScale method of the parent scene node, the collision shape is misplaced.
During my try to track it back, I was wondering why the setShape function has position and rotation input parameters anyway. They seem to be used only for the node input parameter, but i think it's better to change them directly, outside of the method.
Here is some code:
Is there something wrong with my code or is it a missing feature of ogrebullet to be able to use positioning/scaling of parent nodes?
Any help would be much appreciated.
TheNinja
During my try to track it back, I was wondering why the setShape function has position and rotation input parameters anyway. They seem to be used only for the node input parameter, but i think it's better to change them directly, outside of the method.
Here is some code:
SceneNode* nodeHinge = mSceneMgr->getRootSceneNode()->createChildSceneNode("HingeNode");
nodeHinge->setPosition(0, 70, 0); //comment this out to fix misplacement of the shape
Entity* entCol = mSceneMgr->createEntity("StaticColumn", SceneManager::PT_CUBE);
SceneNode* nodeCol = nodeHinge->createChildSceneNode();
nodeCol->attachObject(entCol);
nodeCol->setPosition(150, 70, 0);
nodeCol->setScale(0.1,1.0,0.1);
entCol->setCastShadows(true);
entCol->setNormaliseNormals(true);
entCol->setMaterialName("WoodPallet");
//--- physic stuff begin ---
//OgreBullet code
BoxCollisionShape *CollColShape = new BoxCollisionShape(nodeCol->_getDerivedScale()*55);
ColBody = new RigidBody("ColumnStaticRigid", mWorld);
ColBody->setShape (nodeCol, CollColShape, gStaticBodyRestitution,
gStaticBodyFriction, 50*gDynamicBodyMass,
nodeCol->_getDerivedPosition(),
nodeCol->_getDerivedOrientation());
mWorld->getDebugDrawer()->setDrawAabb(true);
Is there something wrong with my code or is it a missing feature of ogrebullet to be able to use positioning/scaling of parent nodes?
Any help would be much appreciated.
TheNinja