Game Development Community

Problems mounting an emitter

by Toks · in Torque Game Engine · 08/09/2007 (7:25 am) · 1 replies

Hey everyone.

ive got this image i use to shoot particles from a player:

datablock ShapeBaseImageData(HexTargetImage)
{
shapeFile = "~/data/shapes/weapon/model.dts";
emap = true;

mountPoint = 1;
eyeOffset = "0 0 0";
correctMuzzleVector = false;

// namespace as parent
className = "TargetImage";


// Initial start up state
stateName[0] = "Preactivate";
stateEmitter[0] = HexEmitter;
stateEmitterTime[0] = 0.5;
stateEmitterNode[0] = "muzzlePoint";
};

when my projectile collides with a player, i mount this as following:

%col.mountImage(HexTargetImage, 1);

the first time this works correctly and a cloud of particles are shot from the player.
when i want this to be applied a second time simply nothing happens.

i tried unmounting the image first, but that doesnt seem to help. what would cause this?

#1
08/09/2007 (8:14 am)
I fixed it, though the solution again is to unmount image, however it only works when you unmount from a statescript (for some reason). can someone still explain me how this happened?

if you want to copy this sure do:

datablock ShapeBaseImageData(HexTargetImage)
{
// Basic Item properties
shapeFile = "~/data/shapes/weapon/model.dts";
emap = true;

// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 1;
eyeOffset = "0 0 0";
correctMuzzleVector = false;

// namespace as parent
className = "TargetImage";


// state machine
stateName[0] = "Preactivate";
stateEmitter[0] = HexEmitter;
stateEmitterTime[0] = 0.5;
stateEmitterNode[0] = "muzzlePoint";
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "End";

stateName[1] = "End";
stateScript[1] = "clearDamageEmitter";
};

function HexTargetImage::clearDamageEmitter(%this, %obj, %slot)
{
%obj.unmountImage(%slot);
}