Rick Posted July 21, 2013 Share Posted July 21, 2013 I have a script that I attach to a pivot that I can have play a sound. Inside it makes a source from a sound and it seems I need to set it's position and then create a listener so I can contain the sound to a certain area. However, when I call SetPosition on the source it gives the error "Error in SetPosition". self.source:SetPosition(self.entity:GetPosition(true), true) It seems it's because of the true parameter to SetPosition(). If I leave that out it doesn't give the error, BUT it of course also doesn't set the location to the global location which is what I need. Maybe this entity's SetPosition() overload isn't exposed to Lua? I'm following: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/source/sourcesetrange-r321 Also, I notice this creates a Listener. Is there a Listener page in the docs because I couldn't seem to find one? I assume in general we would only make 1 listener and have it follow the player? Quote Link to comment Share on other sites More sharing options...
beo6 Posted July 21, 2013 Share Posted July 21, 2013 according to this: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/source/sourcesetposition-r323 it has not a global parameter but it does set the position always in global space. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 21, 2013 Share Posted July 21, 2013 Looks like we missed the Listener class. It has only one command, Create(). Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted July 21, 2013 Author Share Posted July 21, 2013 What it is and does in the doc would be nice also. If I have a fireplace my assumption on how this all works is: 1) I set the position of the source sound of fire crackling to be over the fire 2) I set the range to a value that I want the player to be able to hear the fire 3) I move a listener around with the player position and if the position of the listener is inside the range of the fire I'll hear it, otherwise I wont. Seems like values < 1 for SetRange() don't do anything? Also this doesn't account for walls and such it seems. Might have to approach this differently. Would be cool to have sources account for these things if possible and adjust audio volume automagically, but for now maybe I'll use a trigger system. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.