angle of polygon

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
Guest

angle of polygon

Post by Guest »

How would it be possible to find the angle at which an image is facing, so that you could calculate the x and y directions it would go using sine and cosine? It would have to be a counter based on 360, but when I try

while key pressed is A and W,

carvelocity += 0.05

carangle +=1.0;
car->setRotation(car->getRotation() + core::vector3df(0,0,carangle));

cary = sin(carangle);
carx = cos(carangle);
v.Y += (cary* carvelocity);
v.X += (carx * carvelocity);



it spins way too fast.

any ideas?

Thanks
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

I think this thread should be in the General forum, because I think it's a general game programming question, rather than Irrlicht specific.

http://echellon.hybd.net/issues/5/artic ... sincos.htm

This is the best article on making "car" or "asteroids spaceship" movement I've ever read. It should help you tweaking your car to perform properly, with velocity, angle, etc.
Guest

Post by Guest »

is there a function for finding the angle of a poly?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

C++ works with radians not grades.
I got problem when I was coding car movement becouse I was using grades in sin/cos functions:

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2233
Post Reply