vertical alignment of fireball trails

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

vertical alignment of fireball trails

Post by Anakin S. »

I used A_SpawnItem to spawn sprites behind a fast projectile. It works fine except for when you shoot up or down. Then it looks like a bunch of steps. Is there a way to get it to be a continuous incline? So far, I replaced the vertical displacement by momz, but I think it's probably more complicated than that. So far this doesn't behave any differently from before.

Code: Select all

FX03 B 0 bright A_SpawnItem("KineticTrail", 1, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 3, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 5, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 7, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 9, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 11, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 13, momz, 0)
FX03 B 0 bright A_SpawnItem("KineticTrail", 15, momz, 0)
FX03 B 1 bright A_SpawnItem("KineticTrail", 17, momz, 0)
Loop
User avatar
MG_Man
Posts: 1401
Joined: Sat Jul 28, 2007 1:24 pm
Contact:

Re: vertical alignment of fireball trails

Post by MG_Man »

Zpos is the vertical height, not the vertical speed. Use the 'x offset' parameter for distance, and '0' for z-momentum. I don't know if momz will work for that, I haven't really messed with this sort of thing.

To do vertical speed, you'll have to use A_SpawnItemEx.
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Re: vertical alignment of fireball trails

Post by Anakin S. »

Thanks. I just realized that I need to make the vertical displacement of each sprite a function of the vertical momentum or whatever variable it is. Is it possible to write an expression for an argument of a decorate action?
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: vertical alignment of fireball trails

Post by Ghastly »

The closest I've ever gotten to this is this: http://forum.zdoom.org/viewtopic.php?f=3&t=20766. As you can see in the thread, though, it has some problems.
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Re: vertical alignment of fireball trails

Post by Anakin S. »

I have the same issue now too. When I fire it from one angle, it works perfectly if I aim up or down or horizontally. However, if I move left and right of that or 180 degrees, the trails end up facing the wrong way.

So when fired straight north (or whichever direction it is), the trail is perpendicular to the path of the projectile. That angle between travel path and trail decreases as you move closer to the west and increases as you move closer to the east. When you're facing directly west, it's perfect. The projectile moves west and the trail is right behind it. When you're facing east, however, it's the opposite. It's as if the trail sprites have a fixed position in space that doesn't take the facing angle into account at all.

That makes me wonder what exactly momx, momy, and momz really are. Are they really just the x, y, and z components of the speed vector? Do they take into account the actor's facing angle?

Here's what I have right now:

Code: Select all

FX03 B 0 bright A_SpawnItemEx("KineticTrail", -(momx/12), -(momy/12), -1*(momz - 10*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -2*(momx/12), -2*(momy/12), -1*(momz - 9*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -3*(momx/12), -3*(momy/12), -1*(momz - 8*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -4*(momx/12), -4*(momy/12), -1*(momz - 7*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -5*(momx/12), -5*(momy/12), -1*(momz - 6*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -6*(momx/12), -6*(momy/12), -1*(momz - 5*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -7*(momx/12), -7*(momy/12), -1*(momz - 4*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -8*(momx/12), -8*(momy/12), -1*(momz - 3*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 0 bright A_SpawnItemEx("KineticTrail", -9*(momx/12), -9*(momy/12), -1*(momz - 2*(momz/12)), 0, 0, 0, 0, 1, 0)
FX03 B 1 bright A_SpawnItemEx("KineticTrail", -10*(momx/12), -10*(momy/12), -1*(momz - 1*(momz/12)), 0, 0, 0, 0, 1, 0)
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: vertical alignment of fireball trails

Post by Ghastly »

Anakin S. wrote:That makes me wonder what exactly momx, momy, and momz really are. Are they really just the x, y, and z components of the speed vector? Do they take into account the actor's facing angle?
Unless you're using the A_SpawnItemEx Absolute Momentum flag, they take map compass direction as momentum. I used the projectile's speed as a base, for the X momentum, when I tried.
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Re: vertical alignment of fireball trails

Post by Anakin S. »

Can we use trig functions?
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Re: vertical alignment of fireball trails

Post by Anakin S. »

I got it to work! I don't know exactly what the problem was, but it was fixed by putting -angle in the angle parameter. I also had to put on absolute position and absolute momentum (10).
User avatar
MG_Man
Posts: 1401
Joined: Sat Jul 28, 2007 1:24 pm
Contact:

Re: vertical alignment of fireball trails

Post by MG_Man »

Damn! Sorry if I say this, but you MUST post the WAD of this.

This is, AFAIK, the first time ever something like this has been perfected with A_SpawnItemEx.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: vertical alignment of fireball trails

Post by Ghastly »

Indeed. I've been trying on and off to get it to work for a while. Just slap together a test wad, with the DoomImpBall doing this.
Locked

Return to “Editing (Archive)”