Directional SFX

Directional SFX

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Emyfour
Posts: 13
Joined: 29 Mar 2014, 13:52

Directional SFX

Post by Emyfour »

Hi there.
Now thanks to your help I'm understanding LUA better, and, obiouvsly, I overstimated my ability and projected something enormous.
Now, I'm managing to find what I need on the wiki, but I didn't find a thing: is it possible, in the animation script, to tell a unit to emit something (smoke, flame etc) directionally, non-radially?

I can't explain myself, I'll give an example: I'm creating a fighter unit and I'd like an afterburner animation if the speed is major than a value. But, if I just use the EmitSfx function, the flame I designed comes out randomly from the engine piece, as it was burning.

Thanx in advance for your help :-)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Directional SFX

Post by FLOZi »

For afterburners, LUPS is the best bet, visually.

If you want to stick with CEG, we'll need some more details. BitmapMuzzleflame is often used for engine flare effects and is directional, you may need to rotate the piece in the script first to ensure it points in the right direction (Generally speaking it is better to EmitSfx from a blank piece which contains no mesh geometry).
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Directional SFX

Post by Beherith »

There are few things about emitting directional cegs with emit-sfx from unit scripts:
If the piece has no geometry, then the sfx is emitted in the +z direction from the origin of the piece.

If the piece has 1 vertex, the emit dir is the vector from the origin to the the position of the first vertex the emit position is the origin of the piece.

If there is more than one vertex in the piece, then the emit vector is the vector pointing from v[0] to v[1], and the emit position is v[0].

Thus it is not common to emit directional effects from pieces with geometry. The standard practice is to create empty pieces and rotate them to the desired direction in the script's Create() method, and use those for emitting.

Added this info to the wiki;
http://springrts.com/wiki/Animation-LuaCallouts#Effects
http://springrts.com/wiki/Animation-CobConstants
User avatar
Emyfour
Posts: 13
Joined: 29 Mar 2014, 13:52

Re: Directional SFX

Post by Emyfour »

Thanks Beherit, I knew I could count on your help.

Oh by the way, I found a topic somewhere about scripting, it said that there were no pages on the wiki about the SFX. It could be changed now, if I remember well, it was something like "stumpy tutorial" and "polishing the stumpy".

Thanks again and GL everyone :lol: :lol: :lol:

EDIT: Ah-ehm, I think a tip would be useful, something like "to get a non-dimensional object to emit SFX from, the simplest way is to add an empty with Upspring in the point you'd like the origin of the effect to be".
Post Reply

Return to “Game Development”