What is wrong with my Precision Aiming
by Caleb · in Torque Game Engine · 10/19/2006 (4:50 pm) · 2 replies
Can someone show me what is wrong with the following code; I get no errors in it.
I'll use it to find NULL points that I've put in some armor with, "myGuy.findAimNode", then set my AI's aiming to it. It sounds good, however, It crashes my game whenever that function is called.
There must be some error that my compiler can't see, but I can't find it either.
Any help would be nice, Thanks.
MatrixF ShapeBase::getNodePosition(U32 imageSlot)
{
MountedImage& image = mMountedImageList[imageSlot];
ShapeBaseImageData* imageData = image.dataBlock;
getImageTransform( imageData->aimNode, &aimTrans );
aimVec = aimTrans.getPosition();
return aimVec;
}
ConsoleMethod(ShapeBase, findAimNode, const char*, 2, 2, "")
{
char *returnBuffer = Con::getReturnBuffer(256);
const MatrixF& mat = object->getNodePosition(1);
Point3F pos;
mat.getColumn(3,&pos);
dSprintf(returnBuffer,256,"%g %g %g",pos.x,pos.y,pos.z);
return returnBuffer;
}I'll use it to find NULL points that I've put in some armor with, "myGuy.findAimNode", then set my AI's aiming to it. It sounds good, however, It crashes my game whenever that function is called.
There must be some error that my compiler can't see, but I can't find it either.
Any help would be nice, Thanks.
Torque Owner J "hplus" W
To debug it further, I suggest you put a breakpoint in the ConsoleMethods first line, and step through it in the debugger, examining the various variable values on each line.