Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Viewport.get_listener_2d() to the scripting API #54612

Closed
mashumafi opened this issue Nov 4, 2021 · 3 comments · Fixed by #97159
Closed

Expose Viewport.get_listener_2d() to the scripting API #54612

mashumafi opened this issue Nov 4, 2021 · 3 comments · Fixed by #97159

Comments

@mashumafi
Copy link
Contributor

mashumafi commented Nov 4, 2021

Godot version

3.4

System information

All

Issue description

get_viewport().get_listener_2d() does not exist. It would be useful to expose this since current camera is exposed already. I am trying to do some logic that would be a lot easier to do knowing the current Listener2D position. I guess another way could be to expose the global position of a listener in case the there is no Listener2D currently and the center of the screen would be used instead.

Steps to reproduce

get_viewport().get_listener_2d() is an error

Minimal reproduction project

Above is enough to reproduce

@akien-mga

This comment has been minimized.

@akien-mga
Copy link
Member

CC @KoBeWi. The 3D get_listener() doesn't seem to be exposed either, but both are implemented in C++.

@akien-mga akien-mga changed the title Cannot call get_listener_2d of Viewport from gdscript Expose Viewport.get_listener_2d() to the scripting API Nov 4, 2021
@KoBeWi
Copy link
Member

KoBeWi commented Nov 4, 2021

Listener2D is a node you need to create yourself, so you can as well keep track of it. It might be tricky with multiple listeners, but you could use groups for this purpose.

That said, since we have methods to get current camera, methods to get current listener wouldn't hurt probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants