File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ # The Splines API
2+
3+ Splines are another amazing UE4 feature.
4+
5+ The following component shows how to move another actor over a spline path:
6+
7+ ``` py
8+ class Spline :
9+ def begin_play (self ):
10+ # get a reference to a spline component
11+ self .spline = self .uobject.get_owner().get_actor_component_by_type(ue.find_class(' SplineComponent' ))
12+ # find the length of the spline
13+ self .max_distance = self .spline.get_spline_length()
14+ self .distance = 0.0
15+ # get a reference to the actor to move (as a blueprint property)
16+ self .actor_to_move = self .uobject.get_owner().get_property(' ObjectToMove' )
17+
18+ def tick (self , delta_time ):
19+ if self .distance >= self .max_distance:
20+ return
21+ # find the next point on the spline
22+ next_point = self .spline.get_world_location_at_distance_along_spline(self .distance)
23+ self .actor_to_move.set_actor_location(next_point)
24+ self .distance += 100 * delta_time
25+ ```
You can’t perform that action at this time.
0 commit comments