Creating a new object to use in the world editor
by University of Central FL (#0003) · in Torque Game Engine · 03/30/2006 (9:30 pm) · 1 replies
I've searched the forums and TDN and I found this nice resource (http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7439) but I'm still having some issues. I'm EXTREMELY new to torque so please bear with me.
I'm basically trying to extend the player class to support rigid body dynamics, but that's way beyond my first step. My first step is simply to copy vehicle.h and vehicle.cc into newly created files RigidShape.h and RigidShape.cc, which I did fine.
Now I'm trying to create a button in the world editor that lets me add RigidShape objects to the world. (I'm using the FPS starter demo as my template).
So in \server\scripts\ I created a file called RigidShape.cs. To that file I added the following datablock:
//----------------------------------------
datablock RigidShapeData(RigidShapeDataBlock)
{
shapeFile = "~/data/shapes/RigidShape/torque_logo.dts";
};
//----------------------------------------
I would post my engine code (RigidShape.h and RigidShape.cc) but I simply replaced all instances of "vehicle" with "rigidShape" so I'm pretty sure they work....they compiled fine.
So after that I went into C:\Torque\SDK\example\creator\editor\EditorGui.cs and I added the following field on line 1253:
%Mission_Item[6] = "RigidShape";
Then I had to create a custom build function for RigidShapes in C:\Torque\SDK\example\creator\editor\ ObjectBuilderGui.gui. I added the following function at the bottom of the file:
//------------------------------------------------------------------------------
// RigidShape
//------------------------------------------------------------------------------
function ObjectBuilderGui::buildRigidShape(%this)
{
%this.className = "RigidShape";
%this.process();
}
That's all the resource said to do, so I tried to run Torque and it crashes every time I try to enter the fps demo. If I run it in debug mode, I get the message "Out of range class id" in bitstream.cc
Anyone have any suggestions?
Thanks in advance,
-Adam
I'm basically trying to extend the player class to support rigid body dynamics, but that's way beyond my first step. My first step is simply to copy vehicle.h and vehicle.cc into newly created files RigidShape.h and RigidShape.cc, which I did fine.
Now I'm trying to create a button in the world editor that lets me add RigidShape objects to the world. (I'm using the FPS starter demo as my template).
So in \server\scripts\ I created a file called RigidShape.cs. To that file I added the following datablock:
//----------------------------------------
datablock RigidShapeData(RigidShapeDataBlock)
{
shapeFile = "~/data/shapes/RigidShape/torque_logo.dts";
};
//----------------------------------------
I would post my engine code (RigidShape.h and RigidShape.cc) but I simply replaced all instances of "vehicle" with "rigidShape" so I'm pretty sure they work....they compiled fine.
So after that I went into C:\Torque\SDK\example\creator\editor\EditorGui.cs and I added the following field on line 1253:
%Mission_Item[6] = "RigidShape";
Then I had to create a custom build function for RigidShapes in C:\Torque\SDK\example\creator\editor\ ObjectBuilderGui.gui. I added the following function at the bottom of the file:
//------------------------------------------------------------------------------
// RigidShape
//------------------------------------------------------------------------------
function ObjectBuilderGui::buildRigidShape(%this)
{
%this.className = "RigidShape";
%this.process();
}
That's all the resource said to do, so I tried to run Torque and it crashes every time I try to enter the fps demo. If I run it in debug mode, I get the message "Out of range class id" in bitstream.cc
Anyone have any suggestions?
Thanks in advance,
-Adam
Torque Owner University of Central FL (#0003)
I forgot to add, I also added the following line to game.cs:
exec("./rigidShape.cs");
To execute the newly created rigidShape script.
-Adam