I'm looking to add Arcing lightning to lightningcannons in my mod PA. I'd like Lightning Cannons to hit their targets and then for another effect to be drawn(probably with lups) to the next closest unit in range as it also takes damage through a gadget and then continues the arc. I don't have any idea how to approach this however.
I only need help with actually drawing the effect. Has anyone done anything like this before that I could use or alternatively could anyone offer me some advice as to how to approach it.
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
do you need help with just the gfx effect or the logic? For the graphic effect I would use a ceg with SpawnCEG, maybe spawn them in a line towards other units or something.
The idea is that when a unit is hit by a specfiy weapon, you get the units that are near the hit unit. Then you loop through those units and deal damage to them. And draw some effects with gl or by spamming cegs.
of course endless possibilies to customize that... ie change the -1 to weaponID in Spring.AddUnitDamage (nearUnits[i], damage/2, 0, attackerID, -1) and you get damage that jumps from unit to unit to unit to unit... will need some condition to jump that or its endless recursion=spring hangs.
local nearUnits = Spring.GetUnitsInCylinder (x,z, 500, unitTeam) 500=range change the team to make it also deal damage to allies. Or spells like in DOTA etc where damaging an enemy heals near allies or whatever.
Is there a way to have the 'arcs' between units as a single textured "beam" (i.e. the lightning weapon in the screenshot) as opposed to a line of discrete CEGs?
Generalizing it, how would one go about drawing a flat 2D texture (i.e. the lightning weapon texture) between two points in world coords, with the texture always 'facing' the camera?
Joined: 10 Sep 2008, 02:11 Location: In search for TheTruth (TM)
Niobium wrote:
knorke wrote:
just quickly did this as a demo:
Is there a way to have the 'arcs' between units as a single textured "beam" (i.e. the lightning weapon in the screenshot) as opposed to a line of discrete CEGs?
Yes! Get the nearest unit, arc to it, and iterate! Make sure you don't arc back to a unit you've already shocked, though!
Alternatively, you could get a list of units near the first shocked unit and do some kind of weird traveling salesman thing, but that's not as nice as the first way, IMO.
Quote:
Generalizing it, how would one go about drawing a flat 2D texture (i.e. the lightning weapon texture) between two points in world coords, with the texture always 'facing' the camera?
That's called a billboard! Look it up! You can draw them with CEGs (probably -- don't take my word for it), but they likely won't scale the way you want them to.
You can also draw them using Lua.
PS: You should figure out a way to draw your lightening procedurally. It'd look a lot better than a prenade texture.
As interesting as all this input has been what we really need answered is this is this...
Niobium wrote:
knorke wrote:
just quickly did this as a demo:
Is there a way to have the 'arcs' between units as a single textured "beam" (i.e. the lightning weapon in the screenshot) as opposed to a line of discrete CEGs?
Generalizing it, how would one go about drawing a flat 2D texture (i.e. the lightning weapon texture) between two points in world coords, with the texture always 'facing' the camera?
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
get some simple spring gl example ie http://answers.springlobby.info/questions/560/drawing-planes-lines-etc-in-the-game-world and replace the coordinates with whatever you need. ie here it is the same code but now vertical. Instead of billboards I would try a technic like used in old new games for trees: 2 planes that are stacked into each other, read more about it at this blog. For the laserthing it would be horinzontal of course. some more examples: The shields in zeroK draw lines to other shields to show linkage. math can be stolen here for curved arcs: The bases in some kernel panic mode are linked with funky arcs iirc. zeroK jumpsets show a 3d arc preview of the flightpath.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum