UE4/5 spline learning (1): basic spline use

Table of contents

Show results:

Production:

components

logic


Show results:

Note: Hold down alt and pull the axis to pull out one more point

Production:

The first step is to create a blueprint named BP_Sline:

components

Then we start looking for components and enter bill. We can see the following. What we want is the first one. The purpose of this is to let you better see where the root component of the spline is:

Then send this to the root component for replacement.

Then add another spline component (there are two below, this time we use the one below):

Then it looks like this:

logic

Then we go to the constructor:

We will write logic here so that the model will follow the spline

First, we create 3 variables:

Make these 3 variables public so we can change these parameters outside.

Then start explaining the logic:

1. Calculate the number of models: This can be determined by entering the total number of models.

2. Calculate the length of the spline: Calculate the length based on the coordinates of the starting point and end point of the spline.

3. Average distribution model: Divide the splines at equal distances and calculate the coordinates of each model.

4. Rotate the model according to the rotation of the spline: Rotate each model according to the rotation angle of the spline so that its direction relative to the spline remains consistent.

5. Determine the spacing between models: It can be determined by inputting parameters or according to the ratio of the number of models and the length of the spline.

6. Generate path: Generate a spline path and arrange each model along the path.

7. Path visualization: Display the generated path to facilitate adjustment.

Here is the blueprint logic:

Put the model you want here:

 Then it worked.

Guess you like

Origin blog.csdn.net/q244645787/article/details/131218020