Boombot triggers a particle
by Jeff C. Huff · in · 10/07/2008 (7:36 pm) · 4 replies
Somebody help me out please...
I have the particles as described on page 278 functioning and would like the trigger found on pages 285-287 to sense the entry of boombot into the trigger and begin the particle cycle. Specifically, I would like suggestions for coding of the "enter trigger code" as requested on page 287.
Thanks in advance!
Jeff
I have the particles as described on page 278 functioning and would like the trigger found on pages 285-287 to sense the entry of boombot into the trigger and begin the particle cycle. Specifically, I would like suggestions for coding of the "enter trigger code" as requested on page 287.
Thanks in advance!
Jeff
About the author
#2
Thanks,
Jeff
10/10/2008 (3:40 pm)
John, I was looking for suggestions or example code to follow. I think that I have that now from Scott G. Once I have a chance to test it I'll post the result.Thanks,
Jeff
#3
To summarize what I'm trying to do....
I have the particle effects as described on page 279 working
I have the code for triggers as described on page 285-286 entered and am ready to implement the reaction code from page 287. What I want is for the reaction code to "call" the particle effect when triggered and have the particle effect cease on exit.
It appears that I'm not understanding methods, because everything I try fails! For example... if I took the last statement in the Particle Effects entry
//register the particle emitter
TorqueObjectDatabase.Instance.Register(objParticleEffect);
return;
and plugged it into the area of the reaction code on page 287 where John has stated ...
//perform enter trigger code here
I get an error telling me that the instance does not exist in this context.
I thought that the problem was that I needed an instance of the particle effect to be called but I haven't had any success with that route either.
Can anyone suggest some sample code for making this work?
10/28/2008 (9:03 am)
Okay, trying to get this to work after a few hours of poking! I need some basic help understanding how and when to "call" the particle effect. I'm primarily an artist trying to implement John's text suggestions.To summarize what I'm trying to do....
I have the particle effects as described on page 279 working
I have the code for triggers as described on page 285-286 entered and am ready to implement the reaction code from page 287. What I want is for the reaction code to "call" the particle effect when triggered and have the particle effect cease on exit.
It appears that I'm not understanding methods, because everything I try fails! For example... if I took the last statement in the Particle Effects entry
//register the particle emitter
TorqueObjectDatabase.Instance.Register(objParticleEffect);
return;
and plugged it into the area of the reaction code on page 287 where John has stated ...
//perform enter trigger code here
I get an error telling me that the instance does not exist in this context.
I thought that the problem was that I needed an instance of the particle effect to be called but I haven't had any success with that route either.
Can anyone suggest some sample code for making this work?
#4
public static void ProcessEnter(T3DTriggerComponent trigger, T3DRigidComponent obj)
{
// perform the enter trigger code here
{
TorqueObject objPlayer = TorqueObjectDatabase.Instance.FindObject("PlayerObject");
T3DParticleEffectComponent objParticleEffect = TorqueObjectDatabase.Instance.FindObject("ParticleEffect");
//if (objPlayer != null && objParticleEffect != null)
//perform the enter trigger code here or play the particle effect
objParticleEffect.PlayEffect(true);
}
}
The problem is that when I trip the trigger I get a error stating "object reference not set to an instance of an object"
Any ideas here?
Thanks,
Jeff
10/31/2008 (11:05 am)
Okay, I'm making progress! I have the trigger working but now I need help with how to PLAY the particle effect.public static void ProcessEnter(T3DTriggerComponent trigger, T3DRigidComponent obj)
{
// perform the enter trigger code here
{
TorqueObject objPlayer = TorqueObjectDatabase.Instance.FindObject
T3DParticleEffectComponent objParticleEffect = TorqueObjectDatabase.Instance.FindObject
//if (objPlayer != null && objParticleEffect != null)
//perform the enter trigger code here or play the particle effect
objParticleEffect.PlayEffect(true);
}
}
The problem is that when I trip the trigger I get a error stating "object reference not set to an instance of an object"
Any ideas here?
Thanks,
Jeff
Associate John Kanalakis
EnvyGames
John K.