"node" is a character that will be moved.
receiver is my own receiver
I also want to draw 3Dbox that will show on wich cube i just pointed. Well my problem is that it draws the box aroud the "node" and move it with "him"
Code: Select all
scene::ISceneNodeAnimator* anim = NULL;
while(device->run())
{
driver->beginScene(true, true, video::SColor(0,255,200,0));
smgr->drawAll();
if(receiver.MouseL() == 1)
{
target = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(core::position2di(receiver.MouseX(),receiver.MouseY()));
anim = smgr->createFlyStraightAnimator(node->getPosition(),target->getPosition(),3500);
target = NULL;
receiver.MReset();
}
if((receiver.MouseL() == 0)&&(receiver.MouseR() == 0))
{
target = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(core::position2di(receiver.MouseX(),receiver.MouseY()));
if(target)
{
if (target->getID()==1)
{
sel_ = target->getBoundingBox();
driver->draw3DBox(sel_);
}
}
target = NULL;
receiver.MReset();
}
if (anim!=NULL)
{
node->addAnimator(anim);
anim->drop();
anim = NULL;
}
driver->endScene();
}
Where is my mistake?[/img]
(i know i should edit the moving method becouse it will change speed etc. but this is not the goal now)