Jump to content

Sound emitter issues...


TemplarAsh
 Share

Recommended Posts

Hi guys,

 

I need some help with sound emitters.

 

I am using this script attached to a pivot next to a wall, with volume tested at 1 and 100. The sound will play inside the editor but when published it will not play. Tried all kinds of things, new map, generic app.lua, stereo vs mono .wav, stock ambient .wavs, I even took the IF statement out of start and I still cannot figure it out.

 

Thank you for the help.

 

~Ash

 

--require "Scripts/Functions/ReleaseTableObjects.lua"

 

Script.soundfile=""--path "Ambient Sound"

Script.range=20.0--float "Range"

Script.volume=1--float "Volume"

Script.pitch=1--float "Pitch"

Script.loop=true--bool "Loop"

 

function Script:Start()

if self.sound~="" then

self.sound = Sound:Load(self.soundfile)

self.entity:EmitSound(self.sound, self.range, self.volume, self.pitch, self.loop);

end

end

 

function Script:Stop()

end

 

function Script:Cleanup()

end

Link to comment
Share on other sites

Hi Beo,

 

I checked and I had the listener on my character controller, but not the camera, so I moved it over to the camera and it does the exact same thing.

 

Should the listener be on the camera instead of the character controller, does it matter, as both seem to work? We only need 1 listener right?

 

I am currently working on a new 3rd person character controller and actually moved the camera code off the character controller and instead attached it to the camera which parents back to the controller, which works but is having its own set of challenges of local vs. global space movement with camera rotation, fun times.

 

I also noticed in testing my autopistol disappears when published but works inside the editor.

 

This is really weird.

 

Still digging...

 

So the autopistol issue was resolved by using the Leadwerks beta version, not the regular 3.3. It appears the sound emitter issue maybe caused by not moving with my character controller. Still working on this but that is what it appears to be doing. More to come smile.png

 

OK so I did fix this. The beta update seemed to help with my simple test map, however I also changed the listener code to this...

 

--Create listener

self.listener = Listener:Create(self.camera)

 

Thank you for the help.

 

~Ash

Edited by TemplarAsh
Link to comment
Share on other sites

Nice that you where able to solve the issue.

it should not matter to what you attach the listener. But the most common is the camera.

 

And as long as you give the listener your parent as argument it should also move with your entity.

 

And i think you should only have a single listener. But i am not sure what happens if you have more.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...