Polygon Confiner for 2D Phantom Cameras #237
LouLou-alive
started this conversation in
Ideas
Replies: 1 comment
-
I have been toying around with the idea of an addon specific There is support for using a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd really like to have a polygon confiner for 2d phantom cameras similar to unity's cinemachine confiner for all sorts of 2D side view games.
Because I need this in my current hobby project I already implemented a primitive but functional version which creates the inner polygon based on _camera_frame_rect and some trigonometry etc. Specifics have to be fledged out though and it might have to be optimised. Here's some sketching of how the camera2D position clamping look's like using the inner polygon.
Maybe the confiner should be an individual node/component, replacing the current limit_node, for a more maintainable design. The confiner component script then extends CollisionPolygon2D (or something similar) for Godot's built in manual vertex editing. The inner polygon is automatically calculated and held as a variable in the script, not editable in the editor.
This way a Tilemap can be assigned to the confiner node (not directly to the pcam2D) and the outer polygon vertices are calculated automatically with a press of a button for example. This would also take concave Tilemap edges into account.
Also, having the confiner be an individual component is the better choice in terms of performance if there are multiple pcams using the same limits.
Honestly, I'm quite green regarding godot, lmk what you think and if I should attempt to further implement something like this.
Beta Was this translation helpful? Give feedback.
All reactions