Skip to content

Commit 697e4d8

Browse files
author
Roberto De Ioris
authored
Create Navigation_API.md
1 parent 0e4a819 commit 697e4d8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/Navigation_API.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
```

0 commit comments

Comments
 (0)