how to make my node face another? (rotation)

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
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

how to make my node face another? (rotation)

Post by ErUs »

like camera setTarget()

how?
varnie
Posts: 31
Joined: Wed Jul 19, 2006 8:27 pm
Location: Russia, Ural

Post by varnie »

here's how i done it in my project:

Code: Select all

     core::vector3df ourPosition    = _monster->getPosition();
      core::vector3df playerPosition = player->getPosition();
   
      core::vector3df direction = ourPosition - playerPosition;
   
      core::vector3df newRotation = direction.getHorizontalAngle() + core::vector3df( 0, 90, 0 );

      _monster->setRotation( newRotation );
in this example monster's node is looking in the player's direction.
hope it helps!
Post Reply