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
angle of polygon
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.
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.
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
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