Game Development Community

ShapeBase won

by Lane Anderson · in Torque Game Engine · 04/18/2005 (5:32 pm) · 7 replies

Hey,


Heres the code(its a modified codesampler tut, just in case you're wondering):

datablock ShapeBaseData( SuperBomb )
{
// The mission editor uses the "category" variable to organize this new
// item under the "shapes" root category.
category = "Bombs";

// Next, we'll tell the mission editor where to find the .dts shape file
// that defines our Super Bomb's geometry.
shapeFile = "~/data/shapes/superbomb/superbomb.dts";


//className = //ShapeBaseData Used to identify this datablock's class. Value can be over-ridden in script.

emap = true; //Specifies whether environment mapping should be enabled for this object.

renderWhenDestroyed = true; //Specifies whether the object should be rendered after it is destroyed.

cameraMaxDist = 0.0; //Maximum allowable camera distance from the eye.
cameraMinDist = 0.2; //The minimum allowable camera distance from the eye.
cameraDefaultFOV = 90.0; //The default Field-of-Vision angle, measured in angles.
cameraMinFOV = 5.0; //The minimum allowable Field-of-Vision angle, measured in angles.
cameraMaxFOV = 120.0; //The maximum allowable Field-of-Vision angle, measured in angles.
useEyePoint = false; //Specifies whether we should use the shape's eye point as the camera viewing point.
observeThroughObject = false; //Specifies whether we observe the object through its camera transform and FOV.
cameraDefaultFOV = 90.0; //The default Field-of-Vision angle, measured in angles.
firstPersonOnly = false; //Specifies whether only first-person view can be used.

computeCRC = false; //Specifies whether the shapeFile CRC must match that sent from the server.

mass = 1.0; //The property of mass, as used in physical simulations.
density = 1.0; //The property of density, as used in physical simulations.
drag = 0.0; //The property of drag, as used in physical simulations.

isInvincible = false; //Specifies whether the entity should be treated as unable to take damage.
maxDamage = 1.0; //The maximum damage that the entity can withstand.
destroyedLevel = 1.0; //The point at which the is considered destroyed, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0. NOTE: This field may be removed in the future.
disabledLevel = 1.0; //The point at which the entity is considered disabled, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0.
repairRate = 0.0033; //Repair rate per tick.

aiAvoidThis = false; //Specifies whether the AI should avoid this object.

};


function ShapeBaseData::create( %data )
{
echo( "ItemData::create for SuperBomb called --------------------------" );

%obj = new ShapeBase()
{
dataBlock = %data;

};

return %obj;
}


function SuperBomb::onCollision( %this, %obj, %col )
{
echo( "SuperBomb::onCollision called ----------------------------------" );

// TO DO: Add code here to have the player react to touching the power-up!
}




Ok, so i fire up my game, and try to add an object. All that shows up is the axis and yellow box that surrounds all object in the mission editor. the actual .dts doesnt show up. No errors show up in the console, and I'm positive that the shape and the path to it are perfect.

#1
04/19/2005 (1:11 pm)
Anyone :D?
#2
04/19/2005 (1:12 pm)
Can you please use code blocks, the way you have it is REALLY hard the eyes.

*edit*
Oh yeah might wanna check your console output where this is attempting to compile, my hunch is that this thing isn't compiling :)
#3
04/19/2005 (2:29 pm)
Here's the datablock again:

datablock ShapeBaseData( SuperBomb )
{

category = "Bombs";

shapeFile = "~/data/shapes/superbomb/superbomb.dts";


emap = true;

renderWhenDestroyed = true;

cameraMaxDist = 0.0;

cameraMinDist = 0.2;

cameraDefaultFOV = 90.0;

cameraMinFOV = 5.0;

cameraMaxFOV = 120.0;

useEyePoint = false;

observeThroughObject = false;

cameraDefaultFOV = 90.0;

firstPersonOnly = false;

computeCRC = false;

mass = 1.0;
density = 1.0;
drag = 0.0;

isInvincible = false;
maxDamage = 1.0;
destroyedLevel = 1.0;
disabledLevel = 1.0;
repairRate = 0.0033;.

aiAvoidThis = false;

};


function ShapeBaseData::create( %data )
{
echo( "ShapeBaseData::create for SuperBomb called --------------" );

%obj = new ShapeBase()
{
dataBlock = %data;

};

return %obj;
}


function SuperBomb::onCollision( %this, %obj, %col )
{
echo( "SuperBomb::onCollision called ----------------------------------" );

}



And there are no errors in the in the console, and it says it compiles perfectly....

???

Thanks,

Lane
#4
04/19/2005 (4:47 pm)
Use something like this...?
This is a code block
I used [ code ] and [ /code ] to surround it (but without the spaces).

Anyway - have you set the object's Ghostable flag? It's been a while since I mucked with that, but I seem to recall having to do that before I could make a deriviative of ShapeBase appear.
#5
04/19/2005 (5:27 pm)
Use StaticShapeData instead.
#6
04/21/2005 (3:52 pm)
Jay: I've set my objects Ghostable flag to "false" but my object still doesn't show up.

Matthew: I'm wanting to be able to use damage on this particular object, and I'm assuming Static Shapes cannot use Damage. Please correct me if I'm Wrong.

Could someone please give me a working Shapebase file with datablock etc, that I can use :D?

Thanks,

Lane
#7
04/21/2005 (5:14 pm)
You can't instatiate ShapaBase objects. You have to use something that is derived from ShapeBase. StaticShapes are directly derived from ShapeBase so it includes all of the functionality that exists in ShapeBase (it add the concept of "powered"). You can do damage completely in script if you like (I did) so relying on ShapeBase for this functionality doesn't make much sense.

I used your datablock as a StaticShapeData (and with a different .dts obviously) and it worked flawlessly.

Setting Ghostable to false means that your objects won't appear on the clients. This is generally considered bad behavior.