FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

UnrealEnginePython/docs/Audio_API.md at master · jonntd/UnrealEnginePython · GitHub

Repository navigation

Latest commit

 

History

History
26 lines (21 loc) · 771 Bytes
  1. UnrealEnginePython
  2. docs

Audio_API.md

File metadata and controls

26 lines (21 loc) · 771 Bytes

The Audio API

The uobject.play_sound_at_location(sound, position[, volume_multiplier, pitch_multiplier, start_time]) api method is exposed:

# get a reference to asound
sound = ue.find_object('my_sound')
# play the sound at position 0,0,0
self.uobject.play_sound_at_location(sound, FVector(0, 0, 0))

If you prefer to work with AudioComponent:

from unreal_engine.classes import AudioComponent

class Sounder:
    def begin_play(self):
        # find the AudioComponent of this actor
        self.audio = self.uobject.get_component_by_type(AudioComponent)
        self.audio.call('Stop')
    def tick(self, delta_time):
        # start the sound when pressing 'A'
        if self.uobject.is_input_key_down('A'):
            self.audio.call('Play')

Back | FazBrowse Home | New Git URL