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

Do we want to have Mouse Passtrough on Sprites / SubViewportSprite in Core? #6524

Open
betalars opened this issue Mar 17, 2023 · 6 comments
Open

Comments

@betalars
Copy link

betalars commented Mar 17, 2023

Describe the project you are working on

A 3D room you walk trough. Users can find mementos in that environment and interact with 3D/objects via a 2D overlay.

Alternatively:
A Game, that has a Computer Panel to interact with.

Describe the problem or limitation you are having in your project

While it is possibe - and there has been a Godot 3.5 Project, that demonstrates this to pass mouse events trough to a view-port Texture, it is a substantial hassle to do so with godot script.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A "click pass-trough" option on a sprite (3D and 2D) that allows mouse events to be passed trough to a view-port that is used as a texture in a spite.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  • there's 2 ways to go about it:
    • there is a checkbox on a sprite
    • having it enabled will
      • dynamically generate a collision area the size of the sprite
      • pass mouse events that area receives to the viewport, transforming them to account for perspective
      • raise a configuration warning if no viewport texture is set
    • Create a dedicated SubViewportSprite2D and SubViewportSprite3D that inherit from Sprite2D/3D and parody the features of SubViewportContainer

If this enhancement will not be used often, can it be worked around with a few lines of script?

It has been demonstrated, that it can be done with a reasonable amount work. So the question if this belongs to core now is more one of Convenience and Consistency.

Is there a reason why this should be core and not an add-on in the asset library?

  • one solution is to extend the Sprite Type, with an add-on can't do iirc
  • I was genuinely confused how this is not an option given how well the general integration of 2D, 3D and UI works with Godot
  • especially having a 3D-Parody of SubViewportContainer feels like a thing that should exist for consistency-sake
@betalars
Copy link
Author

As I actually need this feature myself and it seems to be of reasonable complexity for a first time contributor, I'd like to try and do this on my own if you don't mind.

@TheDuriel
Copy link

Might be cleaner to have a dedicated:

SubViewportSprite2D and SubViewportSprite3D to match SubViewportContainer functionality. But taking a ViewportTexture input, instead of requiring the viewport to be a direct child node.

@betalars
Copy link
Author

Might be cleaner to have a dedicated SubViewportSprite2D

oooh so kind of how sprite2D and sprite 3D kind of are a parody, while not quite inheriting from each other. When first reading this, I kind of got tangled in trying to imagine the inheritance.

yeah, that'd be nice actually.

@Sauermann
Copy link

Related to #4093

I have created a Godot4-Project, that showcases how to implement this in GDScript: godotengine/godot#72657 (comment)

@betalars
Copy link
Author

showcases how to implement this in GDScript: godotengine/godot#72657 (comment)

okay, that still needs some amount of code to work to automatically generate all the required components together (as well as billboard support, witch would be nice) and stuff, but it makes it more feasible to do as an Add-On.

It still seems a bit fundamental to not have it in core, but as @TheDuriel pointed out: you'd kind of have to add two more Classes to make it consistent with the rest of Godot and then we have 2 more components and if we need anything it's maybe reducing the amount of those. 😬

I can use the Demo Project to solve my own Issue for now and will still be happy to have that as my first contribution to Core if that would make people happy.

@betalars betalars changed the title Allow users to chose a mouse passtrough option when using viewports in sprites Do we want to have Mouse Passtrough on Sprites / SubViewportSprite in Core? Mar 18, 2023
@betalars
Copy link
Author

Updated initial Issue to reflect state of Discuission

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

No branches or pull requests

4 participants