Particled Trigger
by Richard_H · in Torque Game Engine · 12/17/2006 (5:17 pm) · 6 replies
Hi,
I'm trying to spawn a particle emitter when I place a trigger, yet there is about no documentation for AttachEffect (the most promising function) and I can't seem to get onAdd to work. create also seems like looking into. Here is what I have so far:
I'm trying to spawn a particle emitter when I place a trigger, yet there is about no documentation for AttachEffect (the most promising function) and I can't seem to get onAdd to work. create also seems like looking into. Here is what I have so far:
function unlimitedRFoodTrigger::onAdd( %this, %obj )
{
%pos = %obj.getPosition();
%p = new ParticleEmitterNode() {
position = %pos;
datablock = "MRFoodSourceEmitterNode";
emitter = MRFoodSourceEmitter;
};
MissionCleanup.add(%p);
error("Added!");
}Does anyone know the simplist way to get this to work?About the author
#2
12/20/2006 (11:54 am)
function unlimitedRFoodTrigger::onAdd( %this, %obj )
{
if ( !isObject( %obj.emitter ) )
{
%pos = %obj.getPosition();
%obj.emitter = new ParticleEmitterNode() {
position = %pos;
datablock = "MRFoodSourceEmitterNode";
emitter = MRFoodSourceEmitter;
};
%obj.emitter.setTransform( %pos SPC "1 0 0 0" );
MissionCleanup.add( %obj.emitter );
error("Added!");
}
}
#3
what would be the remove function then for this?
01/16/2007 (9:27 am)
Thanks Zod for the post .... what would be the remove function then for this?
#4
01/16/2007 (11:06 am)
%obj.delete; ?
#5
01/16/2007 (6:59 pm)
Sorry. So long to reply, I forgot about the thread.. Anyway.%obj.emitter.delete();
#6
01/30/2007 (10:27 am)
Thanks
Torque Owner Richard_H