model make

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
hepastios
Posts: 13
Joined: Sun Oct 15, 2006 10:04 pm

model make

Post by hepastios »

hey i think to i m make 3d model and animate after load irrlich and use this

example ;

if i press w button my model need to move how to i do this


my english not good sorry all ty for help .
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

well your answer is here movement
:wink: always read the tutorials before asking
hepastios
Posts: 13
Joined: Sun Oct 15, 2006 10:04 pm

Post by hepastios »

hi again its not my question answer i have already read movement tutorial. i m need to animate my scene example;

if i push the 'w' button on keyboard sydney model start to move if i push out the 'w' button sydney model stop i cant do this ?
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

first define some boolens
bool up = false;
bool down = false;
bool right = false;
bool left = false;

well first make your class receiver look like this so when u press up key or "w"
the up=event.KeyInput.PressedDown;

Code: Select all

class MyEventReceiver : public IEventReceiver
{

public:
   virtual bool OnEvent(SEvent event)
   {

      if (event.EventType == EET_KEY_INPUT_EVENT)
      {

         switch(event.KeyInput.Key)
         {
         case KEY_KEY_W:
            up = event.KeyInput.PressedDown;

            break;
         case KEY_KEY_S:
            down = event.KeyInput.PressedDown;
            break;
         case KEY_KEY_A:
            left = event.KeyInput.PressedDown;
            break;
         case KEY_KEY_D:
            right = event.KeyInput.PressedDown;
            break;
         }

         return true;
      }



then in your loop put this code

Code: Select all

if (up)
         {

            c.X += 5;
  c.Z -= 5;
//checks if the animation is not running
if (upanim==false)
{
//runs the animation
    ship->setFrameLoop(2, 31);
    upanim=true;

         }
then in the end of your loop at this:

Code: Select all

//checks if the animation is still running
if (upanim==true)
{
//stops the animation
    ship->setFrameLoop(0, 1);
    upanim=false;

         }
well this code is bugy a but i thinku got the idea
Post Reply