Skip to content

Commit 2d2a888

Browse files
author
Roberto De Ioris
committed
2 parents 0a55e5e + 827d5bc commit 2d2a888

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@ uobject.simple_move_to_location(x, y, z)
624624

625625
move to a location using navmesh (see Navigation below)
626626

627+
---
628+
```py
629+
clicked_actor, x, y, z, nx, ny, nz = self.uobject.get_hit_result_under_cursor(channel)
630+
```
631+
632+
get the world point under the mouse cursor (see Navigation below, for an example usage)
627633

628634
Automatic module reloading (Editor only)
629635
----------------------------------------
@@ -660,7 +666,7 @@ class ActorGoingUp:
660666
Navigation
661667
---------
662668

663-
The only exposed navigation-related method is 'simple_move_to_location'. It expects a Pawn with a movement component (like a character)
669+
The only exposed navigation-related method is 'simple_move_to_location'. It expects a Pawn with a movement component (like a Character)
664670

665671
```py
666672
class MoveToTargetComponent:
@@ -674,6 +680,21 @@ class MoveToTargetComponent:
674680
pass
675681
```
676682

683+
Another example for diablo-like movements (click to move, add this component to a character)
684+
685+
```py
686+
class Walker:
687+
def begin_play(self):
688+
self.uobject.show_mouse_cursor()
689+
def tick(self, delta_time):
690+
if not self.uobject.is_input_key_down('LeftMouseButton'):
691+
return
692+
clicked_actor, x, y, z, nx, ny, nz = self.uobject.get_hit_result_under_cursor(ue.COLLISION_CHANNEL_VISIBILITY)
693+
if not clicked_actor:
694+
return
695+
self.uobject.simple_move_to_location(x, y, z)
696+
```
697+
677698
Physics
678699
-------
679700

0 commit comments

Comments
 (0)