Projectile Trail
by Ian Roach · in Torque Game Engine Advanced · 01/02/2009 (8:34 pm) · 6 replies
Im currently trying to implement a line where my bullet fires through the air (1 long dotted trail), i basically want this line to stay in the game , visible to all players permanently,
is this possible ? can projectile trails stay on the screen forever ?
is this possible ? can projectile trails stay on the screen forever ?
About the author
#2
01/03/2009 (2:52 pm)
The best way I can think of to do what you want, and to make it have as small a footprint as possible, would be to make a billboard and replace your particle trail with it.
#3
Here is what I use. I am doing this with AFX, but I don't believe that it's exploiting anything you can't do with stock particles:
What you have to do is set lifetimeMS to a very large number. I don't think it gets clamped, so I think a very large number, specifying many hours, would work.
01/03/2009 (5:46 pm)
It is possible to design a particle emitter that leaves a long dotted line in which the dots appear to be frozen in space. It's probably not the most efficient solution if you need to do a lot of this, but it does work. What you end up with is a particle system with a bunch of fixed dot particles that last a real long time.Here is what I use. I am doing this with AFX, but I don't believe that it's exploiting anything you can't do with stock particles:
datablock ParticleData(WVT_Dot_P)
{
textureName = %mySpellDataPath @ "/Shared/particles/harddot";
dragCoeffiecient = 0;
windCoefficient = 0;
gravityCoefficient = 0;
inheritedVelFactor = 0.00;
lifetimeMS = 12000; // <-- THIS SETS THE DURATION (12 seconds here)
spinRandomMin = 0;
spinRandomMax = 0;
colors[0] = "1 1 0 1";
colors[1] = "1 1 0 1";
sizes[0] = 0.07;
sizes[1] = 0.07;
times[0] = 0.0;
times[1] = 1.0;
};
datablock ParticleEmitterData(WVT_Dot_E)
{
overrideAdvance = true;
ejectionPeriodMS = 8;
ejectionVelocity = 0.0;
thetaMin = 0.0;
thetaMax = 0.0;
particles = "WVT_Dot_P";
};What you have to do is set lifetimeMS to a very large number. I don't think it gets clamped, so I think a very large number, specifying many hours, would work.
#4
That way it's technically only 2 tris instead of crap-tons of particles that stay around forever.
01/05/2009 (6:04 am)
I would think it might be more efficient to spawn a bilboard and scale it out as long as the projectile goes and then maybe have a repeating dash texture.That way it's technically only 2 tris instead of crap-tons of particles that stay around forever.
#5
01/08/2009 (7:12 pm)
A shader could be done too...
#6
01/08/2009 (9:34 pm)
Or convert one of the bullet tracer resources to TGEa. Use a GFX draw utility to render a triangle and then pull/stretch it for x length and let it fade as it travels.
Torque Owner Bobby Leighton
Imagn' Games
Without looking at the code I can say YES, you "CAN" make this happen. However(yes here comes the "But"), anything you can imagine can be implemented when you think about it, the real question you want to know is if this can be done without serious code modifications.
Generally I would play with the "particle lifetime" settings... of the smoke trail...If you increased it to some sort of maximum settings then the particles should hang where they are created and never disappear, but I am unsure if you can do this with the current particle code, have you done anything in the way of trial and error with this in mind?
I can take a look if I have some spare time...Game Programming school is very demanding a the moment:)