Game Development Community

Weird setRotation behavior

by Drew -Gaiiden- Sikora · in Torque Game Builder · 06/29/2006 (6:16 pm) · 2 replies

I have a feeling I'm missing something fundamental here but I can't seem to nail it down. I'm firing off a missile and I want the missile to point in the direction it's going. To do so I use the code
$spaceMissile.setRotation(t2dAngleBetween(%launchPosition, GameData.targetSystem));
The vectors are world coordinates, the missile image stands straight up at 0 degrees, and I'm only doing this calculation when I know the missile is traveling at an angle, but the missile never seems to point in the proper direction. I've looked over the TGB Reference and I see a function called MathInit(), but I'm not sure how to use it (I'm using Foxit Reader and I can't figure out how to click on the hyperlinks in the document). Could this be the problem? Or am I still horrible at trig? :P

#1
06/29/2006 (9:00 pm)
Sounds like my problem, look at the bottom of this thread:
http://www.garagegames.com/mg/forums/result.thread.php?qt=44951
#2
06/29/2006 (10:06 pm)
Try %object.rotateTo(%angle, %speed).