Particle Forces
Particle forces are component that once attached to an entity can alter the behavior of a Particle System. They mostly alter the velocity of the particles, according to a set of rules.
Creating Forces in Evergine Studio.
In the Entities Hierarchy panel of your Scene Editor, click the "Add Entity and select Particles, then choose the kind of force you want to create:
- Point attractor
- Entity attractor
- Wind force
- Drag force
We discuss the force types later in this article.
This will create a new entity the Scene.
The new created entity has a Transform3D component and a new component, depending of the type of the force (See below).
Creating Forces by Code
The following sample code can be used to instantiate an existing material asset and apply to an entity in your scene.
protected override void CreateScene()
{
// Creates tje entity. A Point Attractor in this sample.
Entity particleForce = new Entity()
.AddComponent(new Transform3D())
.AddComponent(new PointAttractorForce()
{
ForceCategory = CollisionCategory3D.All
});
this.Managers.EntityManager.Add(particleForce);
}
Common Properties
All particle forces share a common base class (BaseForce). This class contains the following properties, making them accesible to all forces:
Property | Default value | Description |
---|---|---|
Strength | 1 | Factor of how much the force affects the particles. |
Force Category | All | Category of the force. A force only will affect particle systems that share the same ForceCategory. |
Range Enabled | true | If the force has a maximum range effect. |
Range | 1 | The maximum distance whether tha particle system is affected by the force. |
Decay Enabled | true | If true the particle force will decay over its range. |
Type of Forces
As stated previously, Evergine supports the following particle system forces:
Point Attractor Force
This force gravitationally pulls all the particles into a point. In addition of the common properties of the base class, Particle Attractor Force adds properties for managing a cutout behavior.
Cutout effect
The cutout effect is a behavior affecting particles that goes closer to the attractor center. Instead of being gravitationally pulled to the center and orbiting around that point, The cutout effect causes to drag particles directly to its center, without escaping or keep orbiting. This is useful when we want to control particles that go to a specific point without keep endlessly orbiting around its center.
Property | Default value | Description |
---|---|---|
Cutout Enabled | false | Enables the cutout behavior of the force. |
Cutout Strength | All | The intensity where the particles are dragged into a vortex pit. |
Cutout Range | true | The range where the particles start falling into the force center. |
Entity Attractor Force
The Entity Attractor Force is similar to Point Attractor Force, but the particles are attracted to an Entity. Specifically to all the meshes contained in an entity. It has the same Cutout parameters as previously stated, but in addition it has the following properties:
Property | Default value | Description |
---|---|---|
Source Entity Path | null | The path of the target entity of the force. |
Source Topology | Vertex | The part of the mesh topology towards the particles are attracted. Its values can be Vertex or Triangle |
Note
In this version Evergine does not spport Triangle as Source Topology.
Wind Force
The Wind Force push the particles in the entity's forward direction around its effect area (if the range is enabled). It doesn't have additional parameters. Its strength controls how much the particles are pushed by the wind.
Drag Force
The Wind Force drags the particles around its effect area (if the range is enabled). It doesn't have additional parameters. Its strength controls how much the particles are dragged by the force.