Devcorner: Macros Are Evil

The joys of programming - hours spent scratching one's caput whilst trying to figure out why the seemingly right code does non create right results.

Hi, Charlie here. I used to postal service often.

Where was I? Ah, yes, this nugget of encephalon fudgery from the VDrift forums posted past times NaN:
So I've spent about fourth dimension today drive to figure out why cars are however flight off inwards random directions when hitting curbs sometimes.

It turns out it is a p├Árnikas inwards Bullet, to hold out to a greater extent than specific inwards the SIMD_DEGS_PER_RAD macro.

Code:

#define SIMD_PI           btScalar(3.1415926535897932384626433832795029)
#define SIMD_2_PI         btScalar(2.0) * SIMD_PI
#define SIMD_HALF_PI      (SIMD_PI * btScalar(0.5))
#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0))
#define SIMD_DEGS_PER_RAD  (btScalar(360.0) / SIMD_2_PI)

The start 1 to location it gets a virtual cookie.

For the respond watch the thread, I won't spoil it here. Instead, I'll postal service a screenshot, equally good sourced from said forums as well as taken past times Stunt Rally writer CrystalH.

 


For those who don't know, Stunt Rally is a friendly fork of VDrift.

0 Response to "Devcorner: Macros Are Evil"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel