Game Development Community

Transform Bug Fix

by Tom Spilman · in Torque 3D Professional · 11/03/2009 (11:14 pm) · 0 replies

Hey everyone.

I came across this bug today helping Melv with T2D. It could potentially be causing any number of bugs already posted to these forums, so i felt it was importaint to get this fix to you ASAP.

In sourcemathutilmatrixSet.cpp in the constructor add the following lines:

MatrixSet::MatrixSet()
{
   AssertFatal( ((int)this & 0xF) == 0, "MatrixSet has been allocated off a 16-byte boundary!" );

   MATRIX_SET_BIND_VALUE(ObjectToWorld);
   MATRIX_SET_BIND_VALUE(WorldToCamera);
   MATRIX_SET_BIND_VALUE(CameraToScreen);
   MATRIX_SET_BIND_VALUE(ObjectToCamera);
   MATRIX_SET_BIND_VALUE(WorldToObject);
   MATRIX_SET_BIND_VALUE(CameraToWorld);
   MATRIX_SET_BIND_VALUE(ObjectToScreen);
   MATRIX_SET_BIND_VALUE(CameraToObject);
   MATRIX_SET_BIND_VALUE(WorldToScreen);
   MATRIX_SET_BIND_VALUE(SceneView);
   MATRIX_SET_BIND_VALUE(SceneProjection);

   mViewSource = NULL; // ADDED!
   mProjectionSource = NULL; // ADDED!
}

... it was a pretty bad bug that could cause release builds to have bad transforms in certain cases.

If this solves any problems you've reported before please post a link here and retitle the other thread to FIXED.

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.