On setPosition, my player and all objects attached on it will change it's position, but while my player is falling due to gravity, the attached objects are
falling slower until the player reaches the ground.
Code: Select all
//Load meshes
IMesh* Hairs = smgr->getMesh("../models/Hair.obj");
IAnimatedMesh* MeshModel0 = smgr->getMesh("../models/player.ms3d");
IMesh* MeshModel1 = smgr->getMesh("../models/Sword.obj");
IMesh* MeshModel2 = smgr->getMesh("../models/Sword.ms3d");
//Load player
Player[0] = smgr->addAnimatedMeshSceneNode(MeshModel0);
Player[0]->setFrameLoop(31,37); Player[k]->setAnimationSpeed(15);
Player[0]->setTransitionTime(0.2);
//Create collisions
anim[0] = smgr->createCollisionResponseAnimator( //Kollision für Spieler i einfügen
selector, Player[0], core::vector3df(30,100,30),
core::vector3df(0,-3,0), //gravity
core::vector3df(0,-100,0));
Player[0]->addAnimator(anim[0]);
//Add hair
Head = Player[0]->getMS3DJointNode("Head");
StaticObjects[0] = smgr->addMeshSceneNode(Hairs);
StaticObjects[0] -> setRotation(vector3df(-90,0,90));
StaticObjects[0] -> setPosition(vector3df(-3,0,-13));
Head ->addChild(StaticObjects[0]);
//Add Weapons
Weapon[0] = smgr->addMeshSceneNode(MeshModel1);
Weapon[1] = smgr->addMeshSceneNode(MeshModel2);
//Get pointer
RechteHand[0] = Player[0]->getMS3DJointNode("WeaponR");
LinkeHand[0] = Player[0]->getMS3DJointNode("WeaponL");
//Add weapon to pointer
RechteHand[0]->addChild(Weapon[0]);
LinkeHand[0]->addChild(Weapon[1]);