Skip to content

Commit 50d285b

Browse files
committed
particle behaviors
1 parent d7c50bd commit 50d285b

20 files changed

Lines changed: 276 additions & 196 deletions

pages/docs/appendix/color-spaces.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ ezColorGammaUB gamma = ezColor(0.39f, 0.58f, 0.93f);
6262
## See Also
6363

6464
- Code documentation of `ezColor`.
65-
- [Gamma and Linear Space: What They Are & How They Differ](https://kinematicsoup.com/news/2016/6/15/gamma-and-linear-space-what-they-are-how-they-differ)
66-
- [Unity Manual: Differences between linear and gamma color space](https://docs.unity3d.com/6000.1/Documentation/Manual/differences-linear-gamma-color-space.html)
67-
- [Linear, Gamma, and sRGB Color Spaces (Matt77hias Blog)](https://matt77hias.github.io/blog/2018/07/01/linear-gamma-and-sRGB-color-spaces.html)
65+
* [Gamma and Linear Space: What They Are & How They Differ](https://kinematicsoup.com/news/2016/6/15/gamma-and-linear-space-what-they-are-how-they-differ)
66+
* [Unity Manual: Differences between linear and gamma color space](https://docs.unity3d.com/6000.1/Documentation/Manual/differences-linear-gamma-color-space.html)
67+
* [Linear, Gamma, and sRGB Color Spaces (Matt77hias Blog)](https://matt77hias.github.io/blog/2018/07/01/linear-gamma-and-sRGB-color-spaces.html)

pages/docs/custom-code/visual-script/nodes/index.md

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Visual Script Node Reference
2+
3+
This section documents all the node types available in visual scripts.
4+
5+
## Node Categories
6+
7+
* [Event Handler Nodes](vscript-nodes-events.md) - React to messages and events
8+
* [Blackboard Nodes](vscript-nodes-blackboard.md) - Work with blackboards
9+
* [Time and Clock Nodes](vscript-nodes-time.md) - Access global and world clocks
10+
* [Component Nodes](vscript-nodes-component.md) - Component operations
11+
* [Property Nodes](vscript-nodes-property.md) - Read and write component properties
12+
* [Coroutine Nodes](vscript-nodes-coroutine.md) - Manage coroutines
13+
* [CVar Nodes](vscript-nodes-cvar.md) - Read and write CVars
14+
* [Debug Nodes](vscript-nodes-debug.md) - Debug rendering
15+
* [Enum Nodes](vscript-nodes-enum.md) - Work with enum values
16+
* [Game Object Nodes](vscript-nodes-game-object.md) - Game object operations
17+
* [World Nodes](vscript-nodes-world.md) - Access the world
18+
* [Logic Nodes](vscript-nodes-logic.md) - Conditionals and loops
19+
* [Math Nodes](vscript-nodes-math.md) - Mathematical operations
20+
* [Message Nodes](vscript-nodes-messages.md) - Send messages
21+
* [Physics Nodes](vscript-nodes-physics.md) - Physics engine functions
22+
* [Prefab Nodes](vscript-nodes-prefabs.md) - Spawn prefabs
23+
* [Spatial Nodes](vscript-nodes-spatial.md) - Spatial queries and transforms
24+
* [Sound Nodes](vscript-nodes-sound.md) - Play sounds
25+
* [State Machine Nodes](vscript-nodes-statemachine.md) - Interact with state machines
26+
* [String Nodes](vscript-nodes-string.md) - String operations
27+
* [Logging Nodes](vscript-nodes-log.md) - Log messages
28+
* [Variable and Type Conversion Nodes](vscript-nodes-variables.md) - Variables and type conversion
29+
30+
## See Also
31+
32+
* [Visual Script Class Asset](../visual-script-class-asset.md)
33+
* [Visual Script Overview](../visual-script-overview.md)
34+
* [Script Component](../script-component.md)

pages/docs/custom-code/visual-script/nodes/vscript-nodes-events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Event handlers are nodes that get executed when a certain [message](../../../run
66

77
## See Also
88

9-
- [Visual Script Class Asset](../visual-script-class-asset.md)
10-
- [Visual Script Overview](../visual-script-overview.md)
11-
- [Script Component](../script-component.md)
9+
* [Visual Script Class Asset](../visual-script-class-asset.md)
10+
* [Visual Script Overview](../visual-script-overview.md)
11+
* [Script Component](../script-component.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Bounds Behavior
2+
3+
This behavior can be used for atmospheric effects that should be centered around the player, such as rain, snow or mist. The bounds behavior specifies an area in which particles are allowed. When the player moves, and thus the particle effect is moved to a new location, particles would usually stay behind although not being needed anymore. The bounds behavior can make sure to delete those particles. For some effects it is also vital to fill up the new space quickly. This can be achieved with a very high rate of spawning new particles, though this is often not feasible for atmospheric effects. Instead, the bounds behavior can also just teleport the particles that were left behind, to the new area.
4+
5+
**PositionOffset, Extents:** These values define the size and position of the box, relative to the origin of the particle system. With a position offset of `(0, 0, 0)`, the box will be centered around the system's origin.
6+
7+
**OutOfBoundsMode:** Defines what happens for particles that leave the bounding area.
8+
9+
* **Die:** Particles outside the area will be killed right away.
10+
* **Teleport:** Particles leaving one side of the bounding box will be teleported to the other end of the box. This allows the effect to keep a constant density of particles and is therefore useful for effects that should happen around a player, without being simulated completely in the local space of the player, which would prevent things like using the [raycast behavior](pb-raycast.md). Instead, particles can simulate in global space, and only be teleported on demand. Be aware that this teleportation can still break the effect in various ways, because only the *position* and *last position* of each particle is relocated. Behaviors and [particle renderers](../../particle-renderers.md) that use additional positional data may not work well with this. For example, the [trail renderer's](../particle-renderers.md#trail-renderer) position history is not relocated and therefore trails will suddenly stretch through the entire bounding area after a relocation.
11+
Similarly, an effect that uses the [raycast behavior](pb-raycast.md) to prevent tunneling through geometry, may be able to tunnel through walls, if it is being relocated from an unobstructed area to a position where it should not have been able to get to without the teleportation.
12+
13+
## See Also
14+
15+
* [Particle Behaviors](../particle-behaviors.md)
16+
* [Particle Effects](../particle-effects-overview.md)
17+
* [Particle Initializers](../particle-initializers.md)
18+
* [Particle Renderers](../particle-renderers.md)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Color Gradient Behavior
2+
3+
This behavior changes a particle's color during the update step. A [color gradient](../../../animation/common/color-gradients.md) is used as the color source, and a mode specifies how to look up the color from the gradient.
4+
5+
**Gradient:** The [color gradient](../../../animation/common/color-gradients.md) to use as the source.
6+
7+
**TintColor:** An additional color to be multiplied into the gradient, for tweaking the final result.
8+
9+
**ColorFrom:** This mode specifies how the color is looked up from the gradient:
10+
11+
* `Age` - In this mode the particle's color depends on its age and remaining lifetime. That means it starts out with the leftmost color from the gradient and transitions towards the rightmost color. Optimally, the color gradient should include alpha values, such that the particles can fade out towards the end.
12+
* `Speed` - In this mode the particle's color is determined from its current speed. Slow particles are assigned colors from the left side of the gradient, fast particles that from the right side. This mode only makes sense when either every particle gets a random speed assigned, or when its speed is able to change over time, due to friction, gravity or other factors.
13+
14+
**MaxSpeed:** When using *ColorFrom = Speed*, this value specifies the maximum expected speed of any particle. That speed is then mapped to the rightmost side of the color gradient.
15+
16+
<video src="../media/color-gradient.webm" width="500" height="500" autoplay loop></video>
17+
18+
## See Also
19+
20+
* [Particle Behaviors](../particle-behaviors.md)
21+
* [Particle Effects](../particle-effects-overview.md)
22+
* [Particle Initializers](../particle-initializers.md)
23+
* [Particle Renderers](../particle-renderers.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Fade Out Behavior
2+
3+
This behavior changes a particle's alpha value to gradually fade out over its lifetime. This behavior can also be achieved using a [color gradient behavior](pb-color-gradient.md), however, the fade out behavior is easier to set up and more efficient at runtime.
4+
5+
**StartAlpha:** The alpha value to begin with when the particle has just spawned.
6+
7+
**Exponent:** How quickly to fade the alpha value from `StartAlpha` towards `0` over the particle's lifespan. An exponent of `1` results in a linear fade. An exponent of `2` will make it fade out much earlier, a value of `0.5` will make it fade out very slowly at first and then quite abruptly at the end.
8+
9+
## See Also
10+
11+
* [Particle Behaviors](../particle-behaviors.md)
12+
* [Particle Effects](../particle-effects-overview.md)
13+
* [Particle Initializers](../particle-initializers.md)
14+
* [Particle Renderers](../particle-renderers.md)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Flies Behavior
2+
3+
This behavior moves particles around the emitter center in erratic patterns, similar to a swarm of flies circling something.
4+
5+
**FlySpeed:** The speed with which the particles move.
6+
7+
**PathLength:** The distance that the particles move into some direction before making another turn. The shorter this is, the more often the particles can change direction and thus the smoother the motion becomes. They will also clump up more and stay within the *MaxEmitterDistance*, if the particles can correct their course more often. With a long *PathLength* they may spread out more.
8+
9+
**MaxEmitterDistance:** The maximum distance that the particles will fly away from the effect's center before turning back. If they travel further, they will always steer back towards the emitter. How quickly that is possible though, depends on *PathLength* and *MaxSteeringAngle*.
10+
11+
**MaxSteeringAngle:** Every time a particle has traveled a distance of *PathLength*, it will make a random turn. This value specifies how large that turn may be. A small value results in very slow and wide turns, whereas a large value results in quick and erratic behavior.
12+
13+
<video src="../media/flies.webm" width="500" height="500" autoplay loop></video>
14+
15+
## See Also
16+
17+
* [Particle Behaviors](../particle-behaviors.md)
18+
* [Particle Effects](../particle-effects-overview.md)
19+
* [Particle Initializers](../particle-initializers.md)
20+
* [Particle Renderers](../particle-renderers.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Gravity Behavior
2+
3+
This behavior lets particles fall downwards.
4+
5+
**GravityFactor:** Scales gravity before applying it to the particles' velocity.
6+
7+
<video src="../media/gravity.webm" width="500" height="500" autoplay loop></video>
8+
9+
## See Also
10+
11+
* [Particle Behaviors](../particle-behaviors.md)
12+
* [Particle Effects](../particle-effects-overview.md)
13+
* [Particle Initializers](../particle-initializers.md)
14+
* [Particle Renderers](../particle-renderers.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Pull Along Behavior
2+
3+
Typically once a particle has been spawned, its position is unaffected by changes to the particle effect position. That means when an effect moves around quickly, it may leave a trail of particles behind it, but that trail will be very choppy, unless you have an extremely high particle spawn count and frequency. Thus making something like a rocket exhaust look convincing for a fast moving object can be difficult.
4+
5+
The *pull along behavior* helps to solve this problem by keeping track of any position changes of the particle effect node and applying a fraction of those movements to all the particles' positions as well. This way, if the effect moves a meter, all particles may move 0.8 meters as well. One typically only applies a fraction, such that when the effect moves fast, the particles will be stretched long behind it and not move in perfect unison with the effect node, yielding a more convincing effect.
6+
7+
**Strength:** How much of the effect node's movement should be carried over to the particle positions.
8+
9+
The video below shows two effects beside each other. The left one does not use the pull along behavior, the right one does. As can be seen, the particles on the right stay closer to the moving emitter position.
10+
11+
<video src="../media/pull-along-behavior.webm" width="500" height="500" autoplay loop></video>
12+
13+
## See Also
14+
15+
* [Particle Behaviors](../particle-behaviors.md)
16+
* [Particle Effects](../particle-effects-overview.md)
17+
* [Particle Initializers](../particle-initializers.md)
18+
* [Particle Renderers](../particle-renderers.md)

0 commit comments

Comments
 (0)