Jump to content

SetPosition() on source error


Rick
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

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...