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

"Composer" Effect #5

Open
Bryce-Dixon opened this issue May 22, 2022 · 2 comments
Open

"Composer" Effect #5

Bryce-Dixon opened this issue May 22, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Bryce-Dixon
Copy link
Owner

Is your feature request related to a problem? Please describe.
It's can be difficult to ensure multiple players and important objects are always visible on screen. There should be an effect to ensure a camera is positioned such that it can always see all players and important objects

Describe the solution you'd like
Create a new Effect type that takes multiple targets and weights like LookAtGroup, but ensures they're always on screen by backing up the camera enough

Describe alternatives you've considered
This might be solvable by combining "LookAtGroup" with a new Effect that just repositions itself to be far enough away that the targets are within certain bounds (eg: predetermined angles which define a view frustum).

@Bryce-Dixon Bryce-Dixon added the enhancement New feature or request label May 22, 2022
@aXu-AP
Copy link
Contributor

aXu-AP commented May 27, 2022

I'd imagine following method could work:

  • Project all the targets' positions to screenspace positions (Camera node has unproject_position(), but since we are not working with camera node it needs to be implemented via some matrix magic)
  • Calculate max error (how far objects are from the edges of the screen)
  • Do some more math magic to calculate new distance. This last step I'm not sure if I got the math right and it's a bit hard to explain, so needs some testing.

@Bryce-Dixon Bryce-Dixon self-assigned this May 28, 2022
@Bryce-Dixon
Copy link
Owner Author

Bryce-Dixon commented May 28, 2022

It might be possible to hack Camera.unproject_position() by temporarily setting the camera's transform, calling unproject_position, then setting its transform back. It'd at least be an easy way to get it working and it can be revisited later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants