Hello,
could somebody please post a .blend file on sparks in the BGE? I am struggling to achieve a realistic effect.
Thanks
Hello,
could somebody please post a .blend file on sparks in the BGE? I am struggling to achieve a realistic effect.
Thanks
Ok, small “prisms” or pyramids, with alpha textures, that have “sphere” type collision boundary, rigid body, put on layer 2
make a alpha map texture and put it on it, add a point light and parent it to the “spark”
make a cube static ghost
put this in logic
always---------------------------------------and---------------------------edit-Add object “prisms” (frame length) with light(not many)
do the same with anoth copy of the prism without a light parented to it,
what sort of sparks are you looking for?
I achieved a spark effect by spawning some objects through python, and having those objects spawn trail objects.
I use planes with “halo” facing, so they always point at the player.
It’s part of a bigger project, but if it’s what you need, I could give you a copy.
I’d be careful with attaching lights, as they can eat up your render power quickly.
def spark():
sparkLauncher = sce.objects["sparkLauncher"]
if sparkLauncher["timer"] > .3:
sparkLauncher["timer"] = 0
#move emitter object to random location
sparkLauncher.worldPosition = (random.uniform(-30,30),random.uniform(-15,30),30)
#pick object -red white blue yellow
sparkType = "spark" #random.choice(["tickerTapeR","tickerTapeW","tickerTapeB"])
#spawn object
newSpark = sce.addObject(sparkType, sparkLauncher, 1000)
rotmin = -3.14
rotmax = 3.14
rotx = random.uniform(rotmin,rotmax)
roty = random.uniform(rotmin,rotmax)
rotz = random.uniform(rotmin,rotmax)
newSpark.localOrientation = (rotx,roty,rotz)
#give objects a randomized turning speed, and a local movement speed so they flutter down
newSpark.actuators["Motion"].dLoc = (0,0,random.uniform(-.1,-.2))
I’d be careful with attaching lights, as they can eat up your render power quickly.
Not to mention in multitexture you only get 8 lights >:(
It’d be awesome if you could post a .blend. Thanks!
I get to help!!
I created this test based off of paulstormblader’s code and some guidance earlier today from Cam.dudes that I didn’t fully understand at the time he gave it to me; all for a project I’m currently working on.
Hope it helps.
The spark is in Layer2; I have 3 planes, with 3 different materials on mine, only 1 is needed.
Most of the code comes from Paul’s post above.
The emissions occur from an “Empty” called “Emitter” at the origin.
The LogicEditor section has two entries:
Emitter
Always (True level on, no delay) -------> Python Script
Spark
Motion (Actuator Only, no change in settings)
And, the blend:
BGE_Emitter.blend (475 KB)
THANKKKSSS!!! I don’t know what to say! Thank you very, very much!
I have one more question. Is there a way to make the sparks 3D. As in if you rotate the camera, the spark is visible in each position, rather than two flat planes? Other than that, this is awesome. Thank you very much again!
The script says: ‘#pick object -red white blue yellow’. However I don’t see any color in textured mode, neither GLSL, nor Multitexture. Can somebody help me? I want sparks that are white/slightly yellow at the start, then orange/slightly red at the end. I don’t really know how to achieve that kind of effect.
I’m not sure what you mean; the sparks (At least as I built them) are 3-planed; so they can be seen from any location. You can change the spark to any shape you’d like though (Keep in mind, more faces = more processing power required), as all the script does is to spawn copies of the one spark located on Layer2. Jut make sure your new shape is called “spark” or change the name in the script. Should you choose to, you could even use Suzanne as a spark, so long as it’s on Layer 2 and the script is told it’s name.
The reference to #pick object… is from Paul’s code above. It looks like he had 3 different types of sparks and had the script randomly choose which to display each time. I’m not sure about changing the material, though there are several posts on this forum about the same question.
Edit… Nevermind, now I see the problem. I attached the wrong .blend
Here is the one that belongs with this thread: BGE_Sparks.blend (479 KB)
Thank you very much!