Game Development Community

Added items have no rotation?

by Katrina Rose · in Torque Game Engine · 11/22/2004 (10:00 am) · 2 replies

Hi,

I just created a NPC and used this:

datablock PlayerData (grunt : PlayerBody)
{
      category = "NPC";
      shapeFile = "~/data/shapes/grunt01/grunt01.dts";	
};

and

function PlayerData::create()
{
   %obj= new Player()
   {      
      datablock = grunt;
   };
   %obj.setActionThread("scout");
   %obj.mountImage(m16Image, 0 );
   %obj.setInvItem("m16Ammo",100);
   MissionCleanup.add(%obj);
   return %obj;

}

When I use the F11 editor and bring him in as a shape he comes in just fine. I.E. with a M16 and playing the scout animation. After the mission is saved and restarted he is facing the wrong direction, has no weapon, and is not playing the scout animation. When I look at the mission file I see this:

new Player() {
      position = "93.4183 145.775 100.01";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "grunt";
   };

The rotation was not saved to the mission1.mis file, and I can't figure out why. Any help is apreciated.

Marrion

#1
11/22/2004 (11:47 am)
Should not the Player be AIPlayer instead ?
Maybe thats why !
#2
11/22/2004 (11:49 am)
I did not save after updating the grunts rotation. Now it's saved in the file correctly, but:

As an update I now know what is happening. This must be a bug. I don't know where to fix it in the code. Mabie one of you C++ coders could snoop around to find the solution. What is happening is that when the engine is loading the grunt it is Changing it's rotation into radions instead of degrees. If I capture the grunt in an onadd and convert it's rotation into degrees everything is fine.

Marrion