How might I go about syncing a sound with an arbitrary action. i.e. door close/open

I followed tutorial to have a door rotate open and closed via timeline node, triggered by key press.

It takes 2.25 seconds to rotate open from a fully closed state, and 2.25 to rotate closed from a fully open state.

I have open and close sound effects that are 2.25 seconds in length each, and I’ve successfully hooked them up accordingly.


The door currently can be closed while opening and opened while closing.
I like/want functionality, but it creates a problem with the sounds.

I would hope I could somehow tie the sound effect playback to a time line, but I can’t figure out how to play a sound effect from an arbitrary time in its length.

Any help would be much appreciated.

Add a float track to your timeline that moves linearly between 0-1 across the duration of the timeline and use that to work out exactly at what point to start the sound at (soundDuration / floatScalar = seconds into sound clip to start from). The play sound nodes have ‘start time’ inputs in their extra settings which you can feed into.

Awesome thanks, Baeldan.
I tried searching for but didn’t find anything similar to what you describe.
There’s no doubt is exactly what I need. Thanks a lot for hooking me up with such a concise explanation!
(I’m in the process of implementing it now.)

Sorry I suck at math…
I’m using the Reverse pin on the timeline to close the door, and I’m not familiar with float scalars.

I got 2 tracks on the timeline (SoundLength, and DoorRot):
(each track has 2 points)

-DoorRot (Automatic)

  1. Time: 0:00 Value: 0
  2. Time: 2.25 Value: 90

-SoundLength (Linear)

  1. Time: 0:00 Value: 0
  2. Time: 2.25 Value: 1

I’m using the reverse pin to close the door, so to get me the proper time for the Close Sound Effect I go 1 - SoundLength. (I think that’s correct). I’m not sure how I should divide that value though.

I tried pulling off the SoundLength pin from the timeline and searching for “scalar” but only a “Set Scalar Parameter Value” "Create Parameter Value"appears.

Looking back I see I got the maths wrong in my first comment. You want to multiply by the scalar.

So think of your sound length as the percentage of the way through the track to start at. 1-sound length will indeed get the percentage of the way into the door close track, so duration x (1-soundLength) = your start time for the reverse sound track, and duration x soundLength = your start time for the forward sound track

Thanks again. Finally got it working thanks to you.

It might be overkill, and I’m sure there’s a more efficient way (i.e. just one bool and checking the direction the door’s rotating in or something), but I ended up using 3 bools (IsClosing, IsOpening, and DoorClosed) to know when not to use the scalar.