Game Development Community

StaticShape Collision

by Xavier "eXoDuS" Amado · in Torque Game Engine · 06/13/2002 (2:56 pm) · 9 replies

Well i defined a new StaticShape like this:

datablock StaticShapeData(CaptureFlag)
{
   category = "Flags";
   className = "CaptureFlag";
   shapefile = "fps/data/shapes/special/flag.dts";
};

and then i tried adding this function:

function CaptureFlag::onCollision(%this, %obj, %col)
{
   %this.delete();
}

But nothing happens when i collide with the flag, i think that i might have the wrong amount of parameters in the function declaration?

#1
06/14/2002 (4:54 am)
I have a mine object that will delete ok if I use this:
%obj.delete(); instead of the %this.delete();

The mine has a ItemData datablock though.
#2
06/14/2002 (8:27 am)
well %this should work, since this is refering the CaptureFlag, and %obj is referring the shapebase class

Anyway, that's not the point, i tried using an echo() there too and it still isnt called :\
#3
06/14/2002 (8:43 am)
Not sure why it isn't working (I remember in T2 it was a little 'fuzzy' too, I remember having to jump around the shape), but the %this in the function call refers to the dataBlock while the %obj is the actual object (so you would want to do %obj.delete(), if the collision were working). Just check up on how it's called/evaluated from the engine and you'll see it's so.
#4
11/02/2002 (1:10 pm)
add a collision box to the flag in the model
#5
11/02/2002 (1:32 pm)
Make it an Item instead of a staticShape then when they collide hide the Item(Flag) and create the ShapeBaseImage(Flag) and mount it to slot 2 on the player. Items dont need collision meshes, just a bounds box.
#6
11/03/2002 (7:14 am)
That was a really old post guys :)
I figured it out some time ago.
#7
11/03/2002 (8:31 am)
hey, speaking of static shape collision, I am having a litle problem of my own, my collision doesnt seem to be working for weapon fire, it goes right through everything... does anyone know why this is happening?
#8
05/01/2004 (6:01 am)
Xavier you stated you got this working. Can you please share how you got it working? I'm having a similiar problem with static collisions. They don't happen!
#9
05/04/2004 (12:57 pm)
Do you mean your player cannot collide with them or you can't register the collision in script?