Spell animations?

Hi there, I am trying to create a few spell like effects.

For the first effects, that are auras I used projected textures and I found that the effect worked pretty well. I also created a few dust effects with particles, that while are a pain to create, they work pretty nicely as well.

My problem now is trying to create a chain lighting effect, here is an example:
freakygaming.com/gallery/str … htning.jpg

Any ideas? I tried using a MeshDrawer, but couldn’t really get much done, the documentation doesn’t show much and I couldn’t find any uses on the samples, am I missing something?
Another question, is it possible to use glow effect in a projected texture?

Thanks a lot.

Have you looked at MeshDrawer’s “linkSegment” and “linkSegmentEnd” methods?

If I recall correctly, the general usage is something like this:

self.myMeshDrawer.begin(camera, renderRoot)
#Iterate along your "chain"'s points, creating a segment for each
for i in range(howeverMany):
    # update pos, frame, thickness and colour
    self.myMeshDrawer.linkSegment(pos, frame, thickness, colour)
self.myMeshDrawer.linkSegmentEnd(finalFrame, finalColour)
self.myMeshDrawer.end()

Thanks for the reply, I had tried that with a particle I use to make a poison cloud and the result was terrible. So I spent 2 minutes to draw a terrible lighting on inkscape and adjust some parameters, here is what I got:

dl.dropbox.com/u/10525116/blog_ … htning.png

The effect is what I want (the chain), I need of course, to improve it, probably add a few particles and all.

Thanks a lot.

PS: Since someone may get here searching for the aura effect, here is the code (s is my scenario):

		self.proj = render.attachNewNode(LensNode('proj'))
		lens = PerspectiveLens()
		self.proj.node().setLens(lens)
		self.proj.reparentTo(render)
		self.h = 0
		self.auraZ = 15.0
		self.proj.setPos(self.model.getPos(render) + (0,0, self.auraZ))
		self.proj.setHpr(0, 90, 0)

		self.tex = loader.loadTexture('casting.png')
		
		self.tex.setWrapU(Texture.WMClamp)
		self.tex.setWrapV(Texture.WMClamp)
		self.ts = TextureStage('ts')
		global s
		s.environ.projectTexture(self.ts, self.tex, self.proj)

Rotate the aura effect:

		self.h += 90.0 * globalClock.getDt()
		self.proj.setH(self.h)

Scale the aura (plus follow the character):

		self.auraZ += 2.0 * globalClock.getDt()
		if (self.auraZ > 20):
			self.auraZ = 15.0
		self.proj.setPos(self.model.getPos(render) + (0.0, .0, self.auraZ))

Ah, I’m glad that you got it working. :slight_smile:

If I may make two suggestions, try the following:

  1. Create more than one frame for your lightning, and then, when creating a bolt, randomly select frames for each segment.
    Note: Make sure that every frame starts and ends such that they always tile. For example, have all frames start with the same few pixels, and always end within one or two pixels of that starting row/column (depending on the orientation of your frames).

  2. When creating a bolt, offset a little all but the start and end points of your chain, making the bolt a little jagged. For a perhaps better effect, consider smoothing the results, or taking the previous point into account when choosing the next.