I have problem about enemy.

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
fon3m
Posts: 32
Joined: Thu Sep 28, 2006 9:34 pm

I have problem about enemy.

Post by fon3m »

I did third person. I set direction of enemy is it's will walk follow the actor(player). and i use this code

Code: Select all

p = nodeEn->getPosition(); 
r = nodeEn->getRotation();	
		
rot = ((atan(-(acZ-p.Z)/(acX-p.X)))*57.29)-75;    // angle rotate
r.Y = rot;
nodeEn->setRotation(r);
			
p.X += cos((r.Y) * 3.14 / 180); 
p.Z -= sin((r.Y) * 3.14 / 180); 

nodeEn->setPosition(core::vector3df(p.X,17,p.Z));
and then enemy was rotate follow actor but it's walk wrong direction.
Could you tell me what's wrong?

Thank you
fon3m
Posts: 32
Joined: Thu Sep 28, 2006 9:34 pm

Post by fon3m »

I can do that. :D
Post Reply