Game Development Community

Shell eject in T3D?

by Bryan Morgan · in Torque 3D Professional · 02/07/2010 (12:14 pm) · 3 replies

Is shell ejecting supposed to work in T3D? I don't remember seeing it work in any of the versions FPS demo or other examples. I've created a shotgun with ejectpoint and cloned most of the datablocks from the swarmgun (which has the shell eject datablock info as well) however no shell is ejected or dropped anywhere.

Is there perhaps something wrong in the datablocks? Within my shotgun ShapeBaseImageData datablock I've got:
casing = ShotgunShellCasing;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;

and then I've got the datablock:
datablock DebrisData(ShotgunShellCasing)
{
   shapeFile = "art/shapes/weapons/SwarmGun/rocket.dts";
   lifetime = 6000.0;
   minSpinSpeed = 300.0;
   maxSpinSpeed = 400.0;
   elasticity = 0.65;
   friction = 0.05;
   numBounces = 5;
   staticOnMaxBounce = true;
   snapOnMaxBounce = false;
   fade = true;
};

Is all this correct? I'm using the swarmgun's rocket mesh for now but that shouldn't be a problem since that's what the swarmgun did as well. As this doesn't work with either my gun or the swarmgun in my project or the FPS example project, I'm willing to bet that this is yet another bug that creeped in at some point (if it ever worked in T3D to begin with).

#1
02/07/2010 (12:53 pm)
I haven't checked these but:
1. the model needs an ejection point to spawn the shell from.
2. the finite state of "Reload" needs shellecject set to true.
eg: stateEjectShell[#] = true;
#2
02/07/2010 (1:00 pm)
This approach works for me.

Did you set image trigger setImageTrigger(0, 1) and then setImageTrigger(0, 0)? if no, look at RTS tutorial Attacking secton for more info.

If you change weapon firing routine use shapeBase method ejectShellCasing(slot) in engine code.
#3
02/07/2010 (1:23 pm)
Quote:2. the finite state of "Reload" needs shellecject set to true.
eg: stateEjectShell[#] = true;

Aha, thanks. I didn't even see that line. It is in fact set to false in the swarmgun, and setting it to true for my shotgun works fine now. Now I just need to get the firstperson perspective right, and figure out how to add the players arms to the gun animation so their actually holding the gun rather then the stupid way it's set up in the examples with the Gideon mesh.