playMaker

Author Topic: play audio source simultaneously with movement of object  (Read 2438 times)

Vroemmm

  • Playmaker Newbie
  • *
  • Posts: 4
play audio source simultaneously with movement of object
« on: July 23, 2014, 06:01:24 PM »
I have a simple FSM design. My first person character is able to move a cube when it is close to a cube. I have done this through raycasting. So whenever the first person character controller is within a certain distance from the cube the raycast hits the cube and a numer of actions are executed.

First state = setting up the raycast and tracking when it hits a specific game object. Once the raycast hits the cube it goes to state2 and it executes a number of actions.

action 1=add force
action 2=play audio source
action 3=return to state 1

The audio source clip plays whenever the ray hits and this is fine, however I noticed a delay so that the actual movement of the cube isout of sync with the audio source clip which is the sound of a moving stone. I have reversed the order of actions. So first sound and then add force but that doesn't change anything when running the game.

Wondering if anyone is able to provide help on this how to make sound and a movement of an object simultaneously.

Thanks!

redikann

  • Full Member
  • ***
  • Posts: 174
Re: play audio source simultaneously with movement of object
« Reply #1 on: July 24, 2014, 01:00:40 AM »
You do have the option to make sure the audio clip is indeed playing and then add movement/force.

Vroemmm

  • Playmaker Newbie
  • *
  • Posts: 4
Re: play audio source simultaneously with movement of object
« Reply #2 on: July 25, 2014, 04:51:56 PM »
Thanks Redicann. Still new to playmaker. How would I accomplish that?

redikann

  • Full Member
  • ***
  • Posts: 174
Re: play audio source simultaneously with movement of object
« Reply #3 on: July 25, 2014, 06:41:41 PM »
Oops, sorry. I was getting Plyblox mixed up with playmaker. PB has a block for testing if an audio clip is playing. But what you want to do (syncing) is totally possible with Playmaker. First isolate the delay. Either your audio clip has a delay in it (possible brief silence at the beginning of the recording) or your actions in any particular state will fire as fast as they can so you may need to separate the actions into more states. You can fire the audio and then delay the state transition a little before it translates the object. This can be done with a send event or wait action.

Vroemmm

  • Playmaker Newbie
  • *
  • Posts: 4
Re: play audio source simultaneously with movement of object
« Reply #4 on: July 26, 2014, 04:45:03 PM »
Thx for posting! You made me aware of another great tool "PlyBlox" :)

Vroemmm

  • Playmaker Newbie
  • *
  • Posts: 4
Re: play audio source simultaneously with movement of object
« Reply #5 on: July 26, 2014, 04:55:40 PM »
Solved!

I needed to enable the attribute "Every Frame" within the Add force action. Now it's updating without delay.