Game Development Community

RC2: Incorrect usage of mAtan

by J. Alan Atherton · in Torque Game Builder · 06/13/2006 (8:55 am) · 0 replies

This is a potentially show-stopping set of bugs. In several places throughout the code, I noticed the incorrect usage of mAtan. mAtan simply directly calls atan2, which takes as parameters atan2(y,x), where y is the rise (vertical difference) and x is the run (horizontal difference). Yes, this seems backwards, but look here.

mAtan is used in several places, so any time you get a weird orientation or the angles just seem wrong, it's probably due to the incorrect usage of mAtan. You can't just search and replace, either... sometimes it's right, and sometimes it's wrong. Just be sure that the parameters are (y,x) in every case! Just do a find for mAtan in the entire codebase and look at each usage carefully. It's not a difficult fix, and if it's easier for GG to have me do it, I can.