Game Development Community

Dizzy Camera out of control

by RageO · in Torque Game Engine · 10/20/2006 (6:56 am) · 2 replies

Well Ive been searching throught the forums and code trying to figure out how to move Items while in game.

Im trying to spin the Torque game logo Im using for the game one tutorial. Now I altered the script abut int the logoitem.cs file under the server to try to make the logo spin while the game is playing for a nice effect. When I put this code in the camera spins. Im putting the code in the logoitem.cs (all this based on the tutorial base folder with the first tutorial.)

Here is the logoitem.cs

//------------------------------------------logoitem script---------------------------------
datablock StaticShapeData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";

};


//***My code***
if(%var==0)
{
turnLeft(1);
%var=1;
}
//-----------------------------------------------------------------------------------------------

Result ths camer spins out of control and never stops :)

I am completely new to torque and c++ what am I doing wrong here ? I do not understand why the camera is spinning when I am putting the code in the logoitem script. Can someone enlighten a noob ? I am just trying some basic movement of Items while in game(not key based). I have looked at all the scripts and searched the forums and Im just not finding what I need.
Thanks in advance

#1
10/24/2006 (5:55 am)
Try looking into the file in fps.starter it has an ammo piece spinning around , that you can pickup

sorry for the bad english im kinda in a hurry.
#2
11/01/2006 (11:20 am)
All Item objects have rotation built into them, so you may find it easier if you declare that datablock as in ItemData datablock.

When the item is added to the level all you need to do is set the rotate property to true.

For example:

//------------------------------------------logoitem script---------------------------------
datablock ItemData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";

};

//The following function was taken for the TGE common code in item.cs
function ItemData::create(%data)
{
   // The mission editor invokes this method when it wants to create
   // an object of the given datablock type.  For the mission editor
   // we always create "static" re-spawnable rotating objects.
   %obj = new Item() {
      dataBlock = %data;
      static = true;
      [b]rotate = true;[/b]
   };
   return %obj;
}

This will cause your items to rotate.

--Amr