Unreal Engine 4 uses particle system to realize object trajectory depiction

Unreal Engine 4 uses particle system to realize object trajectory depiction

foreword

Because when the object is moving, I want to observe its overall trajectory in order to adjust its control. I searched online and found that the particle system can achieve such an effect, so I practiced it and recorded it here.

Realize the effect:

track object trajectory

Particle System

UE4's particle system is used to create highly configurable visual and sound effects to enhance the realism and expressiveness of games or other applications. It can simulate various effects, such as fire, smoke, water, explosion, magic, weather, etc., making the game scene more vivid and rich, and bringing players a better sense of immersion.

Using UE4's particle system, developers can achieve their desired visual effects by manipulating the appearance and properties of particles, such as controlling particle size, color, shape, trajectory, rotation, gradient, texture, etc., combined with sound effects, Make the game scene more realistic.

Using Particle System to Realize Object Trajectory

Create a Particle System

The creation of particle systems is described in detail in the Unreal Engine 4 documentation, here is just a brief description, readers can browse the documentation as needed. Here is a link to the documentation: Particle System User Guide | Unreal Engine Documentation (unrealengine.com)

  1. Right-click in the content browser, click Create Particle System, after renaming, name it "test1" here, double-click to open the particle system:

Create a Particle System

Open screen by default

  1. Click "Generate", in the details in the lower left corner, modify the release constant to 1, (you don't need so many)

Modify the number of generated

  1. Modify the life cycle, because we want to display the completion trajectory of the object, we directly click on the check mark at the generation cycle to make it a cross, which means that the generated life cycle is infinite, that is, it always exists.

Modification life cycle

  1. Modify the initial size, because the size of the particles is still too small in the environment, the modification is similar to the above steps, and the modification is as follows, you can modify the size according to your own situation.

Modify the initial size

  1. Modify the initial velocity, because I don't want the particles to move, so I just need their initial velocity to be 0.

Modify the initial speed

  1. Finally, modify the material. It is not suitable for displaying the trajectory in my environment by default. You can modify it according to your preference. I modified it to black.

Before material modification

after modification

Bind the generated position of the particle system to the moving object

The basic settings of the previous particle system have been set up, and the next step is to bind to the moving object to realize the display trajectory.

  1. Open level blueprint

Open level blueprint

  1. Right click on a blank space to create an event tick

Create event tick

  1. Select "Generate Emitter at Position". When I searched, I saw that some bloggers used "Generate Emitter Attached". Although the same effect can be achieved, sometimes the Unreal Engine will crash directly, so Also select "Spawn Emitter at Location".

generate emitter

Select the asset at the emitter "Emitter Template", that is, the particles to be generated, and select the "test1" just now.

  1. Select the Actor component that you want to track, and get its position, bind it to "Location", and complete the effect of simple particle tracking track.

binding position

Realize the effect:

track object trajectory

summary

This article mainly uses the simple configuration of the particle system to realize how to track the trajectory of moving objects in Unreal Engine.

Of course, there are still the following problems to be solved in this tracking track:

  1. How are traces cleared and generated anytime enabled?
  2. After the trajectory is accumulated, whether the generation of particles will bring pressure to the system memory, etc., causing the system to run more and more difficult.

The above two issues need to be clarified and resolved.

If you think my writing is good, please give me a free like! If there are errors in the content, please also give me feedback.

Guess you like

Origin blog.csdn.net/qq_45830323/article/details/130779281