File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ # The Navigation API
2+
3+ The only exposed navigation-related method is 'simple_move_to_location'. It expects a Pawn with a movement component (like a Character)
4+
5+ ``` py
6+ class MoveToTargetComponent :
7+
8+ def begin_play (self ):
9+ # get a 'target point' reference from a pawn public property
10+ target = self .uobject.get_owner().get_property(' target' )
11+ self .uobject.get_owner().simple_move_to_location(target.get_actor_location())
12+
13+ def tick (self , delta_time ):
14+ pass
15+ ```
16+
17+ Another example for diablo-like movements (click to move, add this component to a character)
18+
19+ ``` py
20+ class Walker :
21+ def begin_play (self ):
22+ self .uobject.show_mouse_cursor()
23+ def tick (self , delta_time ):
24+ if not self .uobject.is_input_key_down(' LeftMouseButton' ):
25+ return
26+ hit = self .uobject.get_hit_result_under_cursor(ue.COLLISION_CHANNEL_VISIBILITY )
27+ if not hit:
28+ return
29+ # hit is a unreal_engine.FHitResult object
30+ self .uobject.simple_move_to_location(hit.impact_point)
31+ ```
You can’t perform that action at this time.
0 commit comments