-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Add Shape2D node #6750
Comments
Or a "quick shape" button for Polygon2D, since you can create a circle with a polygon (it could be a plugin like Add Primitives, too). |
@eon-s I think it is better to create a separate node for this purpose, so as not to break backward compatibility and also to have a choice as to the forms of collisions. |
@toby3d If it is indeed done like |
Will a polygon for circle adapt to change in size or scaling? Shape2D must have a level of detail setting to make it adaptable to basic transformations IMO. Shortest/Longest edge setting may works as well, otherwise it will be same as adding a quick shape menu to polygon2D. |
@hubbyist polygons can be resized and scaled, if you need a dynamic circle shaped polygon that mantain some kind of softness when scaled (which does not sound like a common situation*), it could be done with a custom node. Check this amazing plugin to see how much can be done with custom nodes, polygons and curves (with custom handles and all). *I said that is not common because if you need a circle that resizes all the time and stays as a circle, a sprite is a lot better. |
I mean without "adaptive level of detail" a Shape2D node will be pointless. Polygon with "quick shape" menu will do the trick. Polygon can be used for lots of things but if you will alter its size and have to do many times while developing a game this can be tiresome. So an adaptive Shape2D node with parametric properties like radius for circle, semi-major,semi-minor axises for ellipse etc will be handy. Besides I don't understand the reason of
I always tend to think that vectoral/parametric shapes will be better for performance than bitmap sprites. Note: asset29 will be handy for a project I was working on with godot1.1 I was looking forward to port it to 2.x, it will help. 😄 |
@hubbyist for the way Godot works, I think there is no difference on how polygon or a plain sprite is draw, also, with a polygon, if need to change the number of points you need UV corrections too and that could get messy. That plugin is amazing and gets really good deformations, I have used the animationPlayer on the curve and the texture stays smooth (but lot of Bad Polygon! from the collision polygon) |
@eon-s I mostly need asset29 for static levels, but may use as a proof of concept for some quick sand fields deformation. I will give information when I have time. For UV correction issue if it can be done with a simple recalculation, can be added to shape2D node as well I think. I wish I was a C++ programmer to say more about this subject. |
I think that maybe changing Polygon2D to Shape2D would good. Then, Shape2D nodes could draw Curves, Lines, Rectangles, Circles, Cyllinders and other custom Polygons with the current behaviour. |
Forgot to mention, we can actually _draw quick plain color shapes, even arcs or curves without using Polygon. ps: maybe the official site could make a "plugin requests or ideas" like Q&A, I don't know where can be proposed. |
Is it still in the plans? |
It seems that nobody ever claimed this issue. Tagging as PR welcome. |
as eon-s mentioned: I think a 2Dmesh resource would be more valuable. so I can create meshes and reuse them without implementing coustom drawing code. |
@toger5 as I have mentioned on 7042, making resources could be better but not sure if meshes, polygon resources could have more uses on 2D (collisions shapes, polygons, curves, occluders). |
@eon-s that is interesting! using it for other nodes makes a lot of sense. |
@toger5 I think that meshes on sprites (for deformations) are planned for 3.1 |
two base features must provided: 1、auto tracing the contour |
We still need radial shape2D for avoid creating circle by sprite or code. |
Beta is coming: #12543 Any plans? |
If nobody started this already I doubt it will be for 3.0, but 3.1 is going to modify some things on 2D physics, there will be more chances to see something by then. |
This would be really great for fast prototyping. It would remove the need for textures for a small prototype. And make it in turn way faster to play with new gameplay. |
@Neicul Exactly, but it seems that this will not appear in the next releases. |
There is already a Shape2D class: https://godot.readthedocs.io/en/3.0/classes/class_shape2d.html#class-shape2d Inherited By: RayShape2D, CapsuleShape2D, LineShape2D, CircleShape2D, ConcavePolygonShape2D, ConvexPolygonShape2D, RectangleShape2D, SegmentShape2D What is missing? It seems that you're already able to create circles etc. |
@aaronfranke those shapes are limited to collisions, the issue here is for drawing shapes. |
Perhaps this could be implemented similar to 3D MeshInstance primitives. |
It always bugged me how there's a specific collision for shapes but not for actually drawing them |
@KSean222 Please don't bump issues without contributing significant new information; use the 👍 reaction button on the first post instead. |
What's the status on this actually? It has "PR Welcome" label, but the implementing PR was closed, because this feature would be better suited as an addon... |
I agree that as addon could be better even if is a commonly used thing, but Godot also need a "standard assets" package to get a set of addons on project creation (for 3D, 2D, etc.) to "close" this kind of requests... |
As a newbie to Godot I found it confusing that there was no easy way to add a basic 2D shape. Especially because it already has 3D shapes, so why not 2D? Installing a plugin just to be able to add a basic circle, feels like like too much hassle for something should be very straightforward. |
please please add this. what I would suggest is making it take a draw mode property (line or fill) I suggest calling this ShapeRenderer2D |
Since nobody has linked it yet, @henriiquecampos has created a |
this doesn't actully take a shape2D though it only supports 3 shapes |
@aaronfranke Also note that @henriiquecampos is the one who wrote that script, not me. :-) |
It would also be nice to have a single node with multiple shapes, stored in an array. |
please don't do Vector2 arrays make us pass in a actual shape resource |
Note that Shape2D drawing is fairly straighforward with C++:
But what blocks this feature being implemented as a plugin is simply put: the method itself is not exposed to scripting at all. Once this is possible, #16483 can be ported to GDScript easily. EDIT: see #37903. |
I tried the Geometry2D but it seems it's a collision shape and not actual a visual shape. For this issue: |
Moreover, there's a pending proposal which would make the mentioned class collide with the core singleton one, see godotengine/godot-proposals#640 ( |
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
Given the number of 👍 on this, it's worth to notify people that this proposal is now tracked at godotengine/godot-proposals#1126. I'll also take this opportunity and say that I've actually ended up implementing There are other solutions ofcourse, like probably allowing people to make collision shapes visible per node (and not globally):
while allowing to override color for each, which would likely be the most straightforward way to add this kind of feature without bloating the engine with yet another class. But I feel like the engine is becoming too conservative in this regard personally, it wasn't the case when I first started using Godot, hence godotengine/godot-proposals#575). This is fine but if we don't provide a standard GDScript package officially maintained by core devs to cater user needs (with good accessibility and availability), we'll start accumulate frustrated users, and this proposal is one such example IMO. This becomes offtopic so please proceed to godotengine/godot-proposals#1126 for further discussion if you'd like to chime in, as most of what I've written here is already mentioned there, thanks! |
The engine is already available CollisionPolygon2D and CollisionShape2D for draw invisible collision zones. The last allows you to assign simple forms to shape such as a square, circle, and so on... But only Polygon2D there to draw for only custom forms.
Why not include a node Shape2D, through which you can quickly create a visual form of squares, triangles, circles
and lines? Currently to create a simple circle I must import the sprite, making sure it is large enough so that he had clear edge.The text was updated successfully, but these errors were encountered: