0
$\begingroup$

I'd like to build a force field and particle system in Blender Game Engine, what I'd like to achieve is exactly this;

https://media.giphy.com/media/3o6Ygj9GiMMhh5DZo4/source.gif

I want an object to release particles and another object to attract them. But I'm not sure how can I do that since there is no particle system in Blender Game Engine.

I'd be grateful if you can tell me a way to achieve this.

$\endgroup$
1

1 Answer 1

1
$\begingroup$

As you already discovered there is no special "particle" object in the BGE.

You can use ordinary objects (typically mesh objects).

Emitter

As you want to get multiple copies of it, you place the original in an inactive layer.

enter image description here

Have one object (the emitter) in an active layer constantly add copies of the original (e.g. via edit object actuator). You can give the added objects an initial velocity when the original is a physics object (e.g. rigid body).

enter image description here

Alternative/variation

The particles copy the logic of the original too. So the particles can setup themselves e.g. they can play an animation or initiate a random motion.

enter image description here

Force field

Constantly find particle objects within the desired range (e.g. via a near sensors). To focus on particles you can filter the objects by a property (e.g. all particles have the property "particle").

enter image description here

Then you apply forces to all the found objects. You need to create a custom brick (python controller) to read the sensor and apply the according force/velocity/location change.

move_up (simple example)

import bge

sensor = bge.logic.getCurrentController().sensors["Near"]
for particle in sensor.hitObjectList:
    particle.applyForce((0,0,50))

Result

The sample result looks like that:

enter image description here

To pull the particles near the force field center you need to calculate the according forces to do that.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .