Skip to content

Commit 8e1f084

Browse files
author
Roberto De Ioris
committed
2 parents 8ecf987 + 79ab015 commit 8e1f084

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,32 @@ Currently there is no support for defining custom events from python. The best t
548548

549549
![Alt text](screenshots/unreal_screenshot3.png?raw=true "Screenshot 3")
550550

551+
Audio
552+
-----
553+
554+
The uobject.play_sound_at_location(sound, x, y, z[, volume_multiplier, pitch_multiplier, start_time]) api method is exposed:
555+
556+
```py
557+
# get a reference to asound
558+
sound = ue.find_object('my_sound')
559+
# play the sound at position 0,0,0
560+
self.uobject.play_sound_at_location(sound, 0, 0, 0)
561+
```
562+
563+
If you prefer to work with AudioComponent:
564+
565+
```py
566+
class Sounder:
567+
def begin_play(self):
568+
# find the AudioComponent of this actor
569+
self.audio = self.uobject.get_component_by_type('AudioComponent')
570+
self.audio.call('Stop')
571+
def tick(self, delta_time):
572+
# start the sound when pressing 'A'
573+
if self.uobject.is_input_key_down('A'):
574+
self.audio.call('Play')
575+
```
576+
551577
Packaging
552578
---------
553579

0 commit comments

Comments
 (0)