File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -756,6 +756,33 @@ class DestroyMeComponent:
756756
757757you can now call the 'explode' method via blueprints using the 'Call Python Component Method' node
758758
759+ Splines
760+ -------
761+
762+ Splines are another amazing UE4 feature.
763+
764+ The following component shows how to move another actor over a spline path:
765+
766+ ``` py
767+ class Spline :
768+ def begin_play (self ):
769+ # get a reference to a spline component
770+ self .spline = self .uobject.get_owner().get_actor_component_by_type(ue.find_class(' SplineComponent' ))
771+ # find the length of the spline
772+ self .max_distance = self .spline.get_spline_length()
773+ self .distance = 0.0
774+ # get a reference to the actor to move (as a blueprint property)
775+ self .actor_to_move = self .uobject.get_owner().get_property(' ObjectToMove' )
776+
777+ def tick (self , delta_time ):
778+ if self .distance >= self .max_distance:
779+ return
780+ # find the next point on the spline
781+ next_point = self .spline.get_world_location_at_distance_along_spline(self .distance)
782+ self .actor_to_move.set_actor_location(* next_point)
783+ self .distance += 100 * delta_time
784+ ```
785+
759786Blueprints integration
760787----------------------
761788
You can’t perform that action at this time.
0 commit comments