problem with moveing (when it should not ) draw3DBox

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
MarcinS
Posts: 25
Joined: Tue Feb 17, 2009 3:14 pm
Location: Poland

problem with moveing (when it should not ) draw3DBox

Post by MarcinS »

the idea of this little code is to make object moveing by clicikng on "floorcuebes".

"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();
			}

Image


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)
Last edited by MarcinS on Thu Feb 26, 2009 11:07 am, edited 2 times in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Read the documentation for the draw3DBox function, it'll probably tell you that you need to set the driver's transformation matrix and material before calling the function, currently it's using the matrix and material from the previously rendered node.
Image Image Image
Post Reply