I need some help with this.
Here is my colision :
Code: Select all
//Player model
scene::IAnimatedMesh *mesh = (IAnimatedMesh*) smgr->getMesh("media/player.x");
scene::IAnimatedMeshSceneNode *skelNode = (IAnimatedMeshSceneNode*) smgr->addAnimatedMeshSceneNode(mesh);
IAnimatedMesh* q3levelmesh=smgr->getMesh("test.dmf");
ISceneNode* q3node=0;
q3node=smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));
ITriangleSelector* selector=0;
q3node->setMaterialTexture(0,driver->getTexture("Floor05.jpg"));
q3node->setMaterialFlag(EMF_LIGHTING,false);
q3node->setPosition(vector3df(0,-100,50));
selector=smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0),q3node,128);
q3node->setTriangleSelector(selector);
if(selector)
{
ISceneNodeAnimator* triscolanim=smgr->createCollisionResponseAnimator(
selector,skelNode,vector3df(30,24,30),
vector3df(0,-grav_force,0),
vector3df(0.f,-0.f,0.f));
selector->drop();
skelNode->addAnimator(triscolanim);
triscolanim->drop();
}
jumping
Anyone knows how to fixit ?if (skeleton.getAnimType() == CSK_ANIM_JUMP && skeleton.getSecondMotionVariable() < 340) {
f32 wert = pow( 2.f/340.f*skeleton.getSecondMotionVariable()-1 , 2);
core::vector3df pos = player->getPosition();
pos.Y = 10.f * (-wert + 1);
player->setPosition(pos);
}