-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Animate CollisionPolygon2D (Generate CollisionPolygon2D array from Spritesheet) #829
Comments
Should I change the title to be less technical but more descriptive to what this feature would allow people to do (so people will see how useful it is)? Something like Allow animation of CollisionPolygon2D? |
I did some preliminary testing of changing the CollisionPolygon2D in code and it looks promising. I think it should work if the editor is simply able to save the polygon data for a spritesheet and the physics should work out pretty well. So this should be a relatively minor change for the core devs. |
Also, in trying to test how this could work, it becomes very clear how necessary it is to have this implemented directly in Godot. Imagine having just 20 animated sprites, each with 60 frames, with 100 vertices each. It's a ton of data to try to manage by hand. |
Isn't this achievable through making a Godot plugin? |
Good question. I don't think so, but I have to admit I haven't spent that long looking at the Godot code. Ideally Godot would change the CollisionPolygon2D type (or add a new type) to not just be an array of points that make up the polygon, but an array of polygons, one for each frame in the Spritesheet. Further, it would be great if there was a mechanism for Godot to automatically switch the CollisionPolygon2D data when the frame changes... So what I'm asking for is not just a way to generate the CollisionPolygon2D data from a Spritesheet (which would be nice in itself), but a more fully integrated solution for animating the collision shapes. I hope that is clear. |
I was able to implement this in code, but it doesn't work well for performance reasons. In addition to the vast amount of polygon data that needs to be stored in code, GDScript is not able to move the data quickly enough to work well. An internal solution is needed. |
I've previously implemented CSG-like nodes in 2D in the Goost module: goostengine/goost#39. If you're familiar with CSG nodes in 3D, then you'll figure that you can add a bunch of nodes with But to clarify, CSG nodes in 2D are not part of Godot currently. Also, it's important that this functionality also works for all types of collision objects, currently CSG nodes in 3D are limited to static bodies, and the shapes generated from those cannot be applied to rigid bodies. For instance, here's what nodes I use for both static and rigid bodies in 2D: On your part, you'd still have to create some kind of a special importer that would generate those nodes from spritesheet yourself, unless the use case becomes popular enough to be implemented directly in the editor as well. |
@Xrayez Thanks so much for the comment. Sorry for the slow reply, been busy lately and not able to work on my side project... I would love some more information. I've already written an importer that can probably be easily modified to change to your format if it works for me. Do you have sample code of how your CSG-like nodes are used? Is this capability built into Godot or is it a separate module? Thanks for any tips about how to try this out! |
Just for reference, here is what I am currently doing. Here is an array of collision polygons that I animate... Works ok with a fast computer and less then 10 or so asteroids on screen at once. This is 1 asteroid out of probably 100 or so. var aster01f_128 = [ \
PoolVector2Array([Vector2(-7, -28), Vector2(-21, -17), Vector2(-22, -17), Vector2(-28, 0), Vector2(-29, 0), Vector2(-26, 13), Vector2(-26, 16), Vector2(-10, 29), Vector2(-10, 30), Vector2(14, 27), Vector2(16, 27), Vector2(28, -2), Vector2(29, -2), Vector2(21, -21), Vector2(21, -22), Vector2(-7, -29), Vector2(-7, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-17, -23), Vector2(-18, -23), Vector2(-27, -5), Vector2(-28, -5), Vector2(-29, 1), Vector2(-29, 9), Vector2(-21, 21), Vector2(-21, 22), Vector2(-7, 30), Vector2(-7, 31), Vector2(15, 26), Vector2(17, 26), Vector2(28, -3), Vector2(29, -3), Vector2(21, -21), Vector2(21, -22), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-19, -22), Vector2(-20, -22), Vector2(-27, -4), Vector2(-28, -4), Vector2(-29, 3), Vector2(-29, 9), Vector2(-20, 22), Vector2(-20, 23), Vector2(-5, 30), Vector2(-5, 31), Vector2(14, 26), Vector2(17, 26), Vector2(24, 16), Vector2(25, 16), Vector2(28, -5), Vector2(29, -5), Vector2(26, -15), Vector2(26, -17), Vector2(15, -25), Vector2(15, -26), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-6, -28), Vector2(-18, -22), Vector2(-20, -22), Vector2(-25, -12), Vector2(-26, -12), Vector2(-29, 8), Vector2(-29, 9), Vector2(-19, 23), Vector2(-19, 24), Vector2(-6, 29), Vector2(-6, 30), Vector2(8, 28), Vector2(13, 28), Vector2(23, 18), Vector2(24, 18), Vector2(28, 3), Vector2(29, 3), Vector2(21, -21), Vector2(21, -22), Vector2(-6, -29), Vector2(-6, -28)]), \
PoolVector2Array([Vector2(-6, -28), Vector2(-16, -24), Vector2(-18, -24), Vector2(-26, -11), Vector2(-27, -11), Vector2(-28, 5), Vector2(-28, 13), Vector2(-18, 24), Vector2(-18, 25), Vector2(8, 28), Vector2(12, 28), Vector2(22, 19), Vector2(23, 19), Vector2(28, 4), Vector2(29, 4), Vector2(21, -21), Vector2(21, -22), Vector2(-6, -29), Vector2(-6, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-26, -12), Vector2(-27, -12), Vector2(-28, -3), Vector2(-28, 13), Vector2(-18, 24), Vector2(-18, 25), Vector2(-2, 29), Vector2(-2, 30), Vector2(12, 26), Vector2(15, 26), Vector2(28, 4), Vector2(29, 4), Vector2(20, -22), Vector2(20, -23), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-16, -26), Vector2(-18, -26), Vector2(-27, -11), Vector2(-28, -11), Vector2(-27, 10), Vector2(-27, 15), Vector2(-18, 24), Vector2(-18, 25), Vector2(6, 28), Vector2(10, 28), Vector2(23, 17), Vector2(24, 17), Vector2(28, 3), Vector2(29, 3), Vector2(20, -22), Vector2(20, -23), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-17, -26), Vector2(-19, -26), Vector2(-28, -8), Vector2(-29, -8), Vector2(-27, 10), Vector2(-27, 15), Vector2(-16, 25), Vector2(-16, 26), Vector2(8, 27), Vector2(11, 27), Vector2(23, 17), Vector2(24, 17), Vector2(28, 3), Vector2(29, 3), Vector2(20, -22), Vector2(20, -23), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-20, -24), Vector2(-21, -24), Vector2(-28, -8), Vector2(-29, -8), Vector2(-26, 13), Vector2(-26, 17), Vector2(-16, 24), Vector2(-16, 26), Vector2(12, 25), Vector2(14, 25), Vector2(23, 16), Vector2(24, 16), Vector2(28, 1), Vector2(29, 1), Vector2(21, -21), Vector2(21, -22), Vector2(9, -28), Vector2(9, -29), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-21, -24), Vector2(-22, -24), Vector2(-29, -5), Vector2(-30, -5), Vector2(-21, 21), Vector2(-21, 22), Vector2(-10, 28), Vector2(-10, 29), Vector2(7, 26), Vector2(12, 26), Vector2(24, 14), Vector2(25, 14), Vector2(28, 1), Vector2(29, 1), Vector2(20, -22), Vector2(20, -23), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-17, -25), Vector2(-21, -25), Vector2(-25, -16), Vector2(-26, -16), Vector2(-30, -5), Vector2(-30, -2), Vector2(-20, 22), Vector2(-20, 23), Vector2(-10, 28), Vector2(-10, 29), Vector2(8, 25), Vector2(13, 25), Vector2(23, 15), Vector2(24, 15), Vector2(28, 0), Vector2(29, 0), Vector2(20, -22), Vector2(20, -23), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(4, -29), Vector2(-19, -24), Vector2(-22, -24), Vector2(-29, -4), Vector2(-30, -4), Vector2(-26, 12), Vector2(-26, 15), Vector2(-18, 23), Vector2(-18, 24), Vector2(-9, 29), Vector2(2, 29), Vector2(15, 22), Vector2(17, 22), Vector2(29, 0), Vector2(29, -6), Vector2(20, -22), Vector2(20, -23), Vector2(4, -30), Vector2(4, -29)]), \
PoolVector2Array([Vector2(2, -29), Vector2(-21, -23), Vector2(-23, -23), Vector2(-29, -3), Vector2(-30, -3), Vector2(-20, 22), Vector2(-20, 23), Vector2(-5, 30), Vector2(-4, 30), Vector2(13, 22), Vector2(16, 22), Vector2(29, 0), Vector2(29, -7), Vector2(20, -22), Vector2(20, -23), Vector2(2, -30), Vector2(2, -29)]), \
PoolVector2Array([Vector2(1, -29), Vector2(-24, -20), Vector2(-26, -20), Vector2(-29, -6), Vector2(-30, -6), Vector2(-20, 22), Vector2(-20, 23), Vector2(-4, 29), Vector2(-4, 30), Vector2(10, 25), Vector2(12, 25), Vector2(23, 14), Vector2(24, 14), Vector2(29, -1), Vector2(29, -7), Vector2(21, -20), Vector2(21, -22), Vector2(1, -30), Vector2(1, -29)]), \
PoolVector2Array([Vector2(1, -29), Vector2(-22, -21), Vector2(-24, -21), Vector2(-29, -6), Vector2(-30, -6), Vector2(-20, 22), Vector2(-20, 23), Vector2(-2, 29), Vector2(-2, 30), Vector2(10, 25), Vector2(13, 25), Vector2(29, -1), Vector2(29, -7), Vector2(18, -23), Vector2(18, -24), Vector2(1, -30), Vector2(1, -29)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-28, -14), Vector2(-29, -14), Vector2(-30, 2), Vector2(-30, 5), Vector2(-18, 23), Vector2(-18, 24), Vector2(-7, 28), Vector2(-7, 29), Vector2(13, 24), Vector2(15, 24), Vector2(28, -2), Vector2(29, -2), Vector2(18, -23), Vector2(18, -24), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-29, -10), Vector2(-30, -10), Vector2(-29, 3), Vector2(-29, 8), Vector2(-18, 23), Vector2(-18, 24), Vector2(-5, 28), Vector2(-5, 29), Vector2(10, 26), Vector2(12, 26), Vector2(23, 15), Vector2(24, 15), Vector2(28, -2), Vector2(29, -2), Vector2(19, -21), Vector2(19, -23), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-16, -25), Vector2(-18, -25), Vector2(-29, -10), Vector2(-30, -10), Vector2(-29, 4), Vector2(-29, 9), Vector2(-18, 22), Vector2(-18, 24), Vector2(9, 27), Vector2(11, 27), Vector2(24, 14), Vector2(25, 14), Vector2(28, -2), Vector2(29, -2), Vector2(23, -18), Vector2(23, -20), Vector2(7, -28), Vector2(7, -29), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-14, -25), Vector2(-19, -25), Vector2(-30, -7), Vector2(-31, -7), Vector2(-28, 8), Vector2(-28, 12), Vector2(-16, 24), Vector2(-16, 25), Vector2(8, 27), Vector2(11, 27), Vector2(23, 15), Vector2(25, 15), Vector2(28, -2), Vector2(29, -2), Vector2(23, -18), Vector2(23, -20), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-17, -24), Vector2(-20, -24), Vector2(-30, -6), Vector2(-31, -6), Vector2(-28, 8), Vector2(-28, 12), Vector2(-17, 23), Vector2(-17, 24), Vector2(-1, 29), Vector2(1, 29), Vector2(17, 22), Vector2(19, 22), Vector2(27, 9), Vector2(28, 9), Vector2(28, -6), Vector2(28, -11), Vector2(17, -23), Vector2(17, -24), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-18, -23), Vector2(-21, -23), Vector2(-30, -5), Vector2(-31, -5), Vector2(-30, 1), Vector2(-30, 8), Vector2(-17, 23), Vector2(-17, 24), Vector2(-7, 28), Vector2(3, 28), Vector2(18, 21), Vector2(20, 21), Vector2(27, 10), Vector2(28, 10), Vector2(28, -6), Vector2(28, -11), Vector2(20, -21), Vector2(20, -22), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(-9, -27), Vector2(-23, -20), Vector2(-24, -20), Vector2(-30, -3), Vector2(-31, -3), Vector2(-30, 6), Vector2(-30, 9), Vector2(-20, 21), Vector2(-20, 22), Vector2(3, 27), Vector2(10, 27), Vector2(20, 20), Vector2(21, 20), Vector2(28, 5), Vector2(29, 5), Vector2(28, 4), Vector2(28, -11), Vector2(19, -22), Vector2(19, -23), Vector2(-9, -28), Vector2(-9, -27)]), \
PoolVector2Array([Vector2(-9, -27), Vector2(-24, -19), Vector2(-25, -19), Vector2(-30, -2), Vector2(-31, -2), Vector2(-20, 21), Vector2(-20, 22), Vector2(-2, 28), Vector2(-2, 29), Vector2(7, 26), Vector2(12, 26), Vector2(28, 8), Vector2(29, 8), Vector2(28, 3), Vector2(28, -11), Vector2(19, -21), Vector2(19, -23), Vector2(-9, -28), Vector2(-9, -27)]), \
PoolVector2Array([Vector2(-3, -27), Vector2(-12, -26), Vector2(-14, -26), Vector2(-26, -15), Vector2(-27, -15), Vector2(-31, 0), Vector2(-31, 6), Vector2(-23, 18), Vector2(-23, 20), Vector2(-1, 29), Vector2(1, 29), Vector2(15, 23), Vector2(17, 23), Vector2(28, 8), Vector2(29, 8), Vector2(25, -15), Vector2(25, -17), Vector2(9, -27), Vector2(9, -28), Vector2(-3, -28), Vector2(-3, -27)]), \
PoolVector2Array([Vector2(-3, -27), Vector2(-12, -26), Vector2(-14, -26), Vector2(-27, -13), Vector2(-28, -13), Vector2(-31, 0), Vector2(-31, 7), Vector2(-22, 19), Vector2(-22, 21), Vector2(8, 27), Vector2(9, 27), Vector2(17, 22), Vector2(19, 22), Vector2(29, 5), Vector2(30, 5), Vector2(23, -18), Vector2(23, -20), Vector2(-3, -28), Vector2(-3, -27)]), \
PoolVector2Array([Vector2(-5, -27), Vector2(-27, -13), Vector2(-28, -13), Vector2(-31, 4), Vector2(-31, 8), Vector2(-19, 23), Vector2(-19, 24), Vector2(7, 26), Vector2(12, 26), Vector2(29, 5), Vector2(30, 5), Vector2(21, -20), Vector2(21, -21), Vector2(-5, -28), Vector2(-5, -27)]), \
PoolVector2Array([Vector2(-5, -27), Vector2(-15, -24), Vector2(-17, -24), Vector2(-28, -10), Vector2(-29, -10), Vector2(-30, -3), Vector2(-30, 10), Vector2(-18, 24), Vector2(-18, 25), Vector2(7, 26), Vector2(12, 26), Vector2(29, 5), Vector2(30, 5), Vector2(21, -20), Vector2(21, -21), Vector2(-5, -28), Vector2(-5, -27)]), \
PoolVector2Array([Vector2(-6, -27), Vector2(-21, -19), Vector2(-23, -19), Vector2(-28, -9), Vector2(-29, -9), Vector2(-30, -2), Vector2(-30, 10), Vector2(-24, 18), Vector2(-24, 20), Vector2(-16, 25), Vector2(-16, 26), Vector2(7, 26), Vector2(12, 26), Vector2(29, 3), Vector2(30, 3), Vector2(20, -21), Vector2(20, -22), Vector2(-6, -28), Vector2(-6, -27)]), \
PoolVector2Array([Vector2(-6, -27), Vector2(-16, -23), Vector2(-18, -23), Vector2(-28, -8), Vector2(-29, -8), Vector2(-29, 7), Vector2(-29, 13), Vector2(-23, 19), Vector2(-23, 21), Vector2(-14, 26), Vector2(-14, 27), Vector2(9, 25), Vector2(14, 25), Vector2(29, 2), Vector2(30, 2), Vector2(19, -22), Vector2(19, -23), Vector2(-6, -28), Vector2(-6, -27)]), \
PoolVector2Array([Vector2(-7, -27), Vector2(-27, -11), Vector2(-28, -11), Vector2(-29, 4), Vector2(-29, 11), Vector2(-21, 22), Vector2(-21, 23), Vector2(-11, 27), Vector2(-11, 28), Vector2(13, 24), Vector2(16, 24), Vector2(29, 1), Vector2(30, 1), Vector2(27, -10), Vector2(27, -14), Vector2(18, -23), Vector2(18, -24), Vector2(-7, -28), Vector2(-7, -27)]), \
PoolVector2Array([Vector2(-7, -27), Vector2(-20, -20), Vector2(-22, -20), Vector2(-28, -8), Vector2(-29, -8), Vector2(-28, 9), Vector2(-28, 14), Vector2(-20, 23), Vector2(-20, 24), Vector2(11, 24), Vector2(15, 24), Vector2(24, 15), Vector2(25, 15), Vector2(29, 0), Vector2(30, 0), Vector2(18, -23), Vector2(18, -24), Vector2(-7, -28), Vector2(-7, -27)]), \
PoolVector2Array([Vector2(2, -27), Vector2(-11, -26), Vector2(-16, -26), Vector2(-28, -8), Vector2(-29, -8), Vector2(-27, 13), Vector2(-27, 16), Vector2(-17, 25), Vector2(-17, 26), Vector2(-9, 29), Vector2(-8, 29), Vector2(16, 22), Vector2(18, 22), Vector2(28, 6), Vector2(29, 6), Vector2(27, -10), Vector2(27, -14), Vector2(18, -23), Vector2(18, -24), Vector2(2, -28), Vector2(2, -27)]), \
PoolVector2Array([Vector2(-2, -27), Vector2(-14, -25), Vector2(-18, -25), Vector2(-25, -16), Vector2(-26, -16), Vector2(-29, -8), Vector2(-29, 5), Vector2(-23, 21), Vector2(-23, 22), Vector2(-9, 28), Vector2(-9, 29), Vector2(14, 22), Vector2(17, 22), Vector2(23, 17), Vector2(24, 17), Vector2(29, -2), Vector2(30, -2), Vector2(18, -23), Vector2(18, -24), Vector2(-2, -28), Vector2(-2, -27)]), \
PoolVector2Array([Vector2(-3, -27), Vector2(-17, -24), Vector2(-19, -24), Vector2(-27, -13), Vector2(-28, -13), Vector2(-28, 5), Vector2(-28, 12), Vector2(-22, 22), Vector2(-22, 23), Vector2(-8, 29), Vector2(1, 29), Vector2(20, 18), Vector2(22, 18), Vector2(29, 1), Vector2(30, 1), Vector2(21, -20), Vector2(21, -22), Vector2(-3, -28), Vector2(-3, -27)]), \
PoolVector2Array([Vector2(-6, -27), Vector2(-19, -23), Vector2(-21, -23), Vector2(-28, -12), Vector2(-29, -12), Vector2(-28, 5), Vector2(-28, 10), Vector2(-20, 24), Vector2(-20, 25), Vector2(-7, 29), Vector2(3, 29), Vector2(25, 14), Vector2(26, 14), Vector2(29, 1), Vector2(30, 1), Vector2(21, -20), Vector2(21, -22), Vector2(-6, -28), Vector2(-6, -27)]), \
PoolVector2Array([Vector2(-3, -28), Vector2(-19, -23), Vector2(-21, -23), Vector2(-29, -11), Vector2(-30, -11), Vector2(-30, -3), Vector2(-30, 3), Vector2(-19, 25), Vector2(-19, 26), Vector2(-9, 29), Vector2(5, 29), Vector2(25, 14), Vector2(26, 14), Vector2(29, 2), Vector2(30, 2), Vector2(19, -22), Vector2(19, -23), Vector2(-3, -29), Vector2(-3, -28)]), \
PoolVector2Array([Vector2(-5, -28), Vector2(-29, -14), Vector2(-30, -14), Vector2(-30, -6), Vector2(-30, 4), Vector2(-19, 24), Vector2(-19, 26), Vector2(2, 29), Vector2(7, 29), Vector2(25, 14), Vector2(26, 14), Vector2(29, 2), Vector2(30, 2), Vector2(19, -22), Vector2(19, -23), Vector2(-5, -29), Vector2(-5, -28)]), \
PoolVector2Array([Vector2(-6, -28), Vector2(-21, -22), Vector2(-23, -22), Vector2(-30, -12), Vector2(-31, -12), Vector2(-29, 5), Vector2(-29, 8), Vector2(-17, 26), Vector2(-17, 27), Vector2(7, 28), Vector2(9, 28), Vector2(26, 13), Vector2(27, 13), Vector2(29, 2), Vector2(30, 2), Vector2(29, -4), Vector2(29, -10), Vector2(18, -23), Vector2(18, -24), Vector2(-6, -29), Vector2(-6, -28)]), \
PoolVector2Array([Vector2(-8, -28), Vector2(-31, -11), Vector2(-32, -11), Vector2(-29, 5), Vector2(-29, 8), Vector2(-15, 27), Vector2(-15, 28), Vector2(5, 28), Vector2(10, 28), Vector2(27, 12), Vector2(28, 12), Vector2(29, 2), Vector2(30, 2), Vector2(29, -5), Vector2(29, -10), Vector2(18, -23), Vector2(18, -24), Vector2(-8, -29), Vector2(-8, -28)]), \
PoolVector2Array([Vector2(-9, -28), Vector2(-31, -11), Vector2(-32, -11), Vector2(-30, 2), Vector2(-30, 7), Vector2(-15, 27), Vector2(-15, 28), Vector2(0, 32), Vector2(1, 32), Vector2(10, 27), Vector2(12, 27), Vector2(27, 12), Vector2(28, 12), Vector2(29, 1), Vector2(30, 1), Vector2(19, -22), Vector2(19, -23), Vector2(-9, -29), Vector2(-9, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-32, -9), Vector2(-33, -9), Vector2(-28, 10), Vector2(-28, 12), Vector2(-14, 27), Vector2(-14, 28), Vector2(0, 32), Vector2(3, 32), Vector2(14, 24), Vector2(17, 24), Vector2(27, 11), Vector2(29, 11), Vector2(29, 1), Vector2(30, 1), Vector2(23, -18), Vector2(23, -20), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-10, -28), Vector2(-21, -22), Vector2(-23, -22), Vector2(-33, -7), Vector2(-34, -7), Vector2(-27, 12), Vector2(-27, 14), Vector2(-15, 26), Vector2(-15, 27), Vector2(5, 31), Vector2(7, 31), Vector2(21, 20), Vector2(22, 20), Vector2(29, 1), Vector2(30, 1), Vector2(23, -18), Vector2(23, -20), Vector2(-10, -29), Vector2(-10, -28)]), \
PoolVector2Array([Vector2(-6, -28), Vector2(-21, -22), Vector2(-23, -22), Vector2(-33, -6), Vector2(-34, -6), Vector2(-21, 19), Vector2(-21, 21), Vector2(3, 32), Vector2(7, 32), Vector2(29, 8), Vector2(30, 8), Vector2(24, -16), Vector2(24, -18), Vector2(-6, -29), Vector2(-6, -28)]), \
PoolVector2Array([Vector2(-13, -27), Vector2(-25, -20), Vector2(-26, -20), Vector2(-33, -5), Vector2(-34, -5), Vector2(-27, 13), Vector2(-27, 15), Vector2(-14, 26), Vector2(-14, 27), Vector2(6, 32), Vector2(7, 32), Vector2(29, 7), Vector2(30, 7), Vector2(30, -2), Vector2(30, -9), Vector2(21, -20), Vector2(21, -21), Vector2(-13, -28), Vector2(-13, -27)]), \
PoolVector2Array([Vector2(-11, -27), Vector2(-26, -19), Vector2(-27, -19), Vector2(-33, -3), Vector2(-34, -3), Vector2(-32, 6), Vector2(-32, 8), Vector2(-14, 26), Vector2(-14, 27), Vector2(5, 31), Vector2(10, 31), Vector2(29, 6), Vector2(30, 6), Vector2(30, -3), Vector2(30, -9), Vector2(21, -20), Vector2(21, -21), Vector2(-11, -28), Vector2(-11, -27)]), \
PoolVector2Array([Vector2(-11, -27), Vector2(-24, -20), Vector2(-26, -20), Vector2(-32, -7), Vector2(-33, -7), Vector2(-35, 0), Vector2(-35, 2), Vector2(-25, 17), Vector2(-25, 18), Vector2(-5, 30), Vector2(13, 30), Vector2(29, 5), Vector2(30, 5), Vector2(25, -17), Vector2(25, -18), Vector2(12, -25), Vector2(12, -26), Vector2(-11, -28), Vector2(-11, -27)]), \
PoolVector2Array([Vector2(-11, -27), Vector2(-29, -15), Vector2(-30, -15), Vector2(-33, -3), Vector2(-34, -3), Vector2(-34, 6), Vector2(-23, 19), Vector2(-23, 20), Vector2(-4, 30), Vector2(12, 30), Vector2(29, 5), Vector2(30, 5), Vector2(24, -18), Vector2(24, -19), Vector2(-11, -28), Vector2(-11, -27)]), \
PoolVector2Array([Vector2(-13, -26), Vector2(-29, -15), Vector2(-30, -15), Vector2(-33, -3), Vector2(-34, -3), Vector2(-31, 11), Vector2(-31, 13), Vector2(-18, 23), Vector2(-18, 24), Vector2(3, 29), Vector2(14, 29), Vector2(29, 5), Vector2(30, 5), Vector2(29, -1), Vector2(29, -11), Vector2(18, -23), Vector2(18, -24), Vector2(-13, -27), Vector2(-13, -26)]), \
PoolVector2Array([Vector2(-12, -26), Vector2(-17, -24), Vector2(-21, -24), Vector2(-31, -11), Vector2(-32, -11), Vector2(-34, 6), Vector2(-34, 8), Vector2(-24, 18), Vector2(-24, 20), Vector2(1, 29), Vector2(12, 29), Vector2(29, 3), Vector2(30, 3), Vector2(28, -11), Vector2(28, -14), Vector2(18, -22), Vector2(18, -24), Vector2(-12, -27), Vector2(-12, -26)]), \
PoolVector2Array([Vector2(-11, -26), Vector2(-31, -11), Vector2(-32, -11), Vector2(-30, 14), Vector2(-30, 16), Vector2(-5, 29), Vector2(-5, 30), Vector2(7, 28), Vector2(13, 28), Vector2(29, 2), Vector2(30, 2), Vector2(28, -10), Vector2(28, -14), Vector2(15, -25), Vector2(15, -26), Vector2(-11, -27), Vector2(-11, -26)]), \
PoolVector2Array([Vector2(-8, -26), Vector2(-22, -21), Vector2(-24, -21), Vector2(-32, -8), Vector2(-33, -8), Vector2(-28, 17), Vector2(-28, 18), Vector2(-5, 29), Vector2(-5, 30), Vector2(7, 28), Vector2(12, 28), Vector2(18, 24), Vector2(20, 24), Vector2(29, 1), Vector2(30, 1), Vector2(21, -21), Vector2(21, -22), Vector2(-8, -27), Vector2(-8, -26)]), \
PoolVector2Array([Vector2(-7, -26), Vector2(-23, -20), Vector2(-25, -20), Vector2(-31, -10), Vector2(-32, -10), Vector2(-34, 5), Vector2(-34, 7), Vector2(-28, 18), Vector2(-28, 19), Vector2(3, 30), Vector2(7, 30), Vector2(19, 23), Vector2(21, 23), Vector2(29, 0), Vector2(30, 0), Vector2(21, -21), Vector2(21, -22), Vector2(-7, -27), Vector2(-7, -26)]), \
PoolVector2Array([Vector2(3, -27), Vector2(-18, -22), Vector2(-21, -22), Vector2(-33, -5), Vector2(-34, -5), Vector2(-28, 18), Vector2(-28, 20), Vector2(-2, 29), Vector2(-2, 30), Vector2(17, 24), Vector2(19, 24), Vector2(27, 9), Vector2(28, 9), Vector2(27, -9), Vector2(27, -15), Vector2(14, -26), Vector2(14, -27), Vector2(3, -28), Vector2(3, -27)]), \
PoolVector2Array([Vector2(2, -27), Vector2(-24, -18), Vector2(-26, -18), Vector2(-33, -3), Vector2(-34, -3), Vector2(-26, 21), Vector2(-26, 22), Vector2(0, 29), Vector2(0, 30), Vector2(15, 25), Vector2(17, 25), Vector2(27, 8), Vector2(28, 8), Vector2(27, -9), Vector2(27, -15), Vector2(12, -27), Vector2(12, -28), Vector2(2, -28), Vector2(2, -27)]), \
PoolVector2Array([Vector2(7, -28), Vector2(-21, -20), Vector2(-23, -20), Vector2(-33, -3), Vector2(-34, -3), Vector2(-26, 22), Vector2(-26, 23), Vector2(11, 28), Vector2(13, 28), Vector2(29, 3), Vector2(29, -7), Vector2(24, -18), Vector2(24, -20), Vector2(7, -29), Vector2(7, -28)]), \
PoolVector2Array([Vector2(4, -28), Vector2(-23, -18), Vector2(-25, -18), Vector2(-33, 0), Vector2(-34, 0), Vector2(-25, 23), Vector2(-25, 24), Vector2(-7, 28), Vector2(-7, 29), Vector2(14, 26), Vector2(16, 26), Vector2(29, 1), Vector2(29, -7), Vector2(23, -20), Vector2(23, -21), Vector2(4, -29), Vector2(4, -28)]), \
PoolVector2Array([Vector2(3, -28), Vector2(-21, -19), Vector2(-23, -19), Vector2(-33, 0), Vector2(-34, 0), Vector2(-24, 24), Vector2(-24, 25), Vector2(13, 27), Vector2(15, 27), Vector2(29, 0), Vector2(29, -7), Vector2(22, -21), Vector2(22, -22), Vector2(3, -29), Vector2(3, -28)]), \
PoolVector2Array([Vector2(2, -28), Vector2(-22, -18), Vector2(-24, -18), Vector2(-33, 4), Vector2(-34, 4), Vector2(-22, 26), Vector2(-22, 27), Vector2(14, 26), Vector2(16, 26), Vector2(26, 12), Vector2(27, 12), Vector2(28, -6), Vector2(28, -10), Vector2(22, -21), Vector2(22, -22), Vector2(2, -29), Vector2(2, -28)]), \
PoolVector2Array([Vector2(0, -28), Vector2(-24, -16), Vector2(-26, -16), Vector2(-32, 0), Vector2(-33, 0), Vector2(-33, 11), Vector2(-21, 27), Vector2(-21, 28), Vector2(13, 26), Vector2(16, 26), Vector2(26, 13), Vector2(27, 13), Vector2(28, -5), Vector2(28, -10), Vector2(21, -22), Vector2(21, -23), Vector2(0, -29), Vector2(0, -28)]), \
PoolVector2Array([Vector2(0, -28), Vector2(-24, -15), Vector2(-26, -15), Vector2(-32, 2), Vector2(-33, 2), Vector2(-33, 11), Vector2(-20, 28), Vector2(-20, 29), Vector2(14, 25), Vector2(17, 25), Vector2(27, 11), Vector2(28, 11), Vector2(28, -5), Vector2(28, -10), Vector2(20, -23), Vector2(20, -24), Vector2(0, -29), Vector2(0, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-19, -19), Vector2(-21, -19), Vector2(-31, -5), Vector2(-32, -5), Vector2(-32, 0), Vector2(-32, 13), Vector2(-18, 29), Vector2(-18, 30), Vector2(-9, 29), Vector2(6, 29), Vector2(18, 22), Vector2(21, 22), Vector2(27, 11), Vector2(28, 11), Vector2(27, -9), Vector2(27, -13), Vector2(20, -23), Vector2(20, -24), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-14, -23), Vector2(-16, -23), Vector2(-31, -4), Vector2(-32, -4), Vector2(-31, 11), Vector2(-31, 16), Vector2(-16, 30), Vector2(-16, 31), Vector2(-5, 29), Vector2(6, 29), Vector2(19, 21), Vector2(21, 21), Vector2(28, 9), Vector2(29, 9), Vector2(27, -9), Vector2(27, -12), Vector2(20, -23), Vector2(20, -24), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(0, -28), Vector2(-13, -24), Vector2(-15, -24), Vector2(-31, -3), Vector2(-32, -3), Vector2(-29, 17), Vector2(-29, 19), Vector2(-14, 31), Vector2(-14, 32), Vector2(19, 21), Vector2(21, 21), Vector2(28, 9), Vector2(29, 9), Vector2(26, -11), Vector2(26, -14), Vector2(20, -22), Vector2(20, -24), Vector2(0, -29), Vector2(0, -28)]), \
PoolVector2Array([Vector2(-4, -27), Vector2(-14, -24), Vector2(-16, -24), Vector2(-31, -2), Vector2(-32, -2), Vector2(-29, 16), Vector2(-29, 19), Vector2(-21, 26), Vector2(-21, 28), Vector2(-12, 32), Vector2(-12, 33), Vector2(1, 29), Vector2(6, 29), Vector2(21, 19), Vector2(23, 19), Vector2(28, 8), Vector2(29, 8), Vector2(29, -7), Vector2(20, -22), Vector2(20, -24), Vector2(-4, -28), Vector2(-4, -27)]), \
PoolVector2Array([Vector2(-5, -27), Vector2(-16, -23), Vector2(-18, -23), Vector2(-30, -3), Vector2(-31, -3), Vector2(-27, 20), Vector2(-27, 22), Vector2(-11, 33), Vector2(-7, 33), Vector2(18, 22), Vector2(20, 22), Vector2(28, 8), Vector2(29, 8), Vector2(29, -7), Vector2(20, -21), Vector2(20, -23), Vector2(-5, -28), Vector2(-5, -27)]), \
PoolVector2Array([Vector2(2, -28), Vector2(-15, -23), Vector2(-18, -23), Vector2(-31, 2), Vector2(-32, 2), Vector2(-26, 21), Vector2(-26, 23), Vector2(-10, 32), Vector2(-10, 33), Vector2(17, 22), Vector2(19, 22), Vector2(29, 4), Vector2(29, -8), Vector2(17, -25), Vector2(17, -26), Vector2(2, -29), Vector2(2, -28)]), \
PoolVector2Array([Vector2(0, -28), Vector2(-16, -22), Vector2(-20, -22), Vector2(-31, 5), Vector2(-32, 5), Vector2(-25, 22), Vector2(-25, 24), Vector2(-8, 32), Vector2(-8, 33), Vector2(21, 19), Vector2(22, 19), Vector2(29, 2), Vector2(29, -8), Vector2(18, -23), Vector2(18, -25), Vector2(0, -29), Vector2(0, -28)]), \
PoolVector2Array([Vector2(-1, -28), Vector2(-19, -21), Vector2(-21, -21), Vector2(-30, 3), Vector2(-31, 3), Vector2(-24, 23), Vector2(-24, 25), Vector2(-12, 31), Vector2(-12, 32), Vector2(6, 29), Vector2(10, 29), Vector2(21, 19), Vector2(22, 19), Vector2(28, 8), Vector2(29, 8), Vector2(28, -8), Vector2(28, -11), Vector2(16, -25), Vector2(16, -26), Vector2(-1, -29), Vector2(-1, -28)]), \
PoolVector2Array([Vector2(-2, -28), Vector2(-20, -20), Vector2(-22, -20), Vector2(-27, -11), Vector2(-28, -11), Vector2(-30, 2), Vector2(-30, 13), Vector2(-21, 26), Vector2(-21, 28), Vector2(-5, 32), Vector2(-5, 33), Vector2(6, 29), Vector2(11, 29), Vector2(29, 1), Vector2(30, 1), Vector2(27, -11), Vector2(27, -13), Vector2(16, -24), Vector2(16, -26), Vector2(-2, -29), Vector2(-2, -28)]), \
PoolVector2Array([Vector2(-3, -28), Vector2(-21, -19), Vector2(-23, -19), Vector2(-28, -9), Vector2(-29, -9), Vector2(-30, 6), Vector2(-30, 13), Vector2(-19, 28), Vector2(-19, 29), Vector2(0, 32), Vector2(5, 32), Vector2(18, 22), Vector2(19, 22), Vector2(29, 3), Vector2(30, 3), Vector2(27, -11), Vector2(27, -13), Vector2(16, -24), Vector2(16, -26), Vector2(-3, -29), Vector2(-3, -28)]), \
PoolVector2Array([Vector2(-2, -28), Vector2(-19, -20), Vector2(-21, -20), Vector2(-28, -9), Vector2(-29, -9), Vector2(-29, 15), Vector2(-22, 24), Vector2(-22, 26), Vector2(-3, 32), Vector2(5, 32), Vector2(15, 25), Vector2(17, 25), Vector2(29, 3), Vector2(30, 3), Vector2(21, -19), Vector2(21, -21), Vector2(-2, -29), Vector2(-2, -28)]), \
PoolVector2Array([Vector2(-3, -28), Vector2(-20, -19), Vector2(-22, -19), Vector2(-28, -9), Vector2(-29, -9), Vector2(-29, 12), Vector2(-29, 13), Vector2(-22, 24), Vector2(-22, 26), Vector2(-13, 31), Vector2(-13, 32), Vector2(5, 31), Vector2(8, 31), Vector2(20, 20), Vector2(21, 20), Vector2(29, 1), Vector2(30, 1), Vector2(18, -23), Vector2(18, -24), Vector2(-3, -29), Vector2(-3, -28)]), \
PoolVector2Array([Vector2(-3, -28), Vector2(-9, -26), Vector2(-13, -26), Vector2(-29, -6), Vector2(-30, -6), Vector2(-28, 9), Vector2(-28, 15), Vector2(-20, 26), Vector2(-20, 27), Vector2(-9, 32), Vector2(-9, 33), Vector2(8, 30), Vector2(10, 30), Vector2(22, 17), Vector2(23, 17), Vector2(29, 0), Vector2(30, 0), Vector2(18, -23), Vector2(18, -24), Vector2(-3, -29), Vector2(-3, -28)]), \
PoolVector2Array([Vector2(-5, -28), Vector2(-12, -25), Vector2(-15, -25), Vector2(-29, -6), Vector2(-30, -6), Vector2(-26, 16), Vector2(-26, 20), Vector2(-16, 29), Vector2(-16, 30), Vector2(8, 30), Vector2(10, 30), Vector2(28, 2), Vector2(29, 2), Vector2(28, -9), Vector2(28, -12), Vector2(18, -22), Vector2(18, -24), Vector2(-5, -29), Vector2(-5, -28)]), \
PoolVector2Array([Vector2(6, -29), Vector2(-13, -24), Vector2(-16, -24), Vector2(-29, -5), Vector2(-30, -5), Vector2(-25, 17), Vector2(-25, 21), Vector2(-17, 28), Vector2(-17, 29), Vector2(8, 30), Vector2(10, 30), Vector2(22, 17), Vector2(23, 17), Vector2(29, 0), Vector2(29, -9), Vector2(6, -30), Vector2(6, -29)]), \
PoolVector2Array([Vector2(4, -29), Vector2(-16, -23), Vector2(-18, -23), Vector2(-29, -4), Vector2(-30, -4), Vector2(-21, 24), Vector2(-21, 25), Vector2(-9, 32), Vector2(-9, 33), Vector2(5, 30), Vector2(10, 30), Vector2(22, 17), Vector2(23, 17), Vector2(29, -1), Vector2(29, -9), Vector2(15, -25), Vector2(15, -26), Vector2(4, -30), Vector2(4, -29)]), \
PoolVector2Array([Vector2(2, -29), Vector2(-14, -23), Vector2(-17, -23), Vector2(-29, -3), Vector2(-30, -3), Vector2(-20, 25), Vector2(-20, 26), Vector2(-7, 32), Vector2(-7, 33), Vector2(11, 28), Vector2(13, 28), Vector2(27, 8), Vector2(28, 8), Vector2(29, -3), Vector2(29, -10), Vector2(15, -25), Vector2(15, -26), Vector2(2, -30), Vector2(2, -29)]), \
PoolVector2Array([Vector2(1, -29), Vector2(-15, -22), Vector2(-18, -22), Vector2(-29, -2), Vector2(-30, -2), Vector2(-20, 24), Vector2(-20, 26), Vector2(-6, 32), Vector2(-6, 33), Vector2(9, 28), Vector2(13, 28), Vector2(27, 8), Vector2(28, 8), Vector2(29, -7), Vector2(29, -10), Vector2(13, -26), Vector2(13, -27), Vector2(1, -30), Vector2(1, -29)]), \
PoolVector2Array([Vector2(1, -29), Vector2(-16, -21), Vector2(-19, -21), Vector2(-29, 0), Vector2(-30, 0), Vector2(-18, 26), Vector2(-18, 27), Vector2(-6, 32), Vector2(-6, 33), Vector2(11, 27), Vector2(14, 27), Vector2(28, 7), Vector2(28, -12), Vector2(13, -26), Vector2(13, -27), Vector2(1, -30), Vector2(1, -29)]), \
PoolVector2Array([Vector2(1, -29), Vector2(-19, -19), Vector2(-21, -19), Vector2(-29, 2), Vector2(-30, 2), Vector2(-17, 26), Vector2(-17, 28), Vector2(-4, 33), Vector2(-3, 33), Vector2(18, 23), Vector2(19, 23), Vector2(28, -6), Vector2(28, -12), Vector2(1, -30), Vector2(1, -29)]), \
PoolVector2Array([Vector2(-2, -28), Vector2(-18, -19), Vector2(-20, -19), Vector2(-27, -8), Vector2(-28, -8), Vector2(-29, -4), Vector2(-29, 9), Vector2(-17, 25), Vector2(-17, 27), Vector2(8, 30), Vector2(10, 30), Vector2(18, 24), Vector2(19, 24), Vector2(28, 3), Vector2(29, 3), Vector2(23, -18), Vector2(23, -20), Vector2(-2, -29), Vector2(-2, -28)]), \
PoolVector2Array([Vector2(-4, -28), Vector2(-18, -18), Vector2(-20, -18), Vector2(-28, -4), Vector2(-29, -4), Vector2(-28, 9), Vector2(-28, 12), Vector2(-14, 28), Vector2(-14, 29), Vector2(10, 29), Vector2(12, 29), Vector2(28, 3), Vector2(29, 3), Vector2(21, -20), Vector2(21, -22), Vector2(-4, -29), Vector2(-4, -28)]), \
PoolVector2Array([Vector2(-5, -28), Vector2(-18, -19), Vector2(-19, -19), Vector2(-28, -3), Vector2(-29, -3), Vector2(-26, 14), Vector2(-26, 16), Vector2(-12, 29), Vector2(-12, 30), Vector2(2, 31), Vector2(7, 31), Vector2(17, 24), Vector2(20, 24), Vector2(28, 0), Vector2(29, 0), Vector2(21, -20), Vector2(21, -22), Vector2(-5, -29), Vector2(-5, -28)]), \
PoolVector2Array([Vector2(-6, -28), Vector2(-18, -19), Vector2(-20, -19), Vector2(-28, -2), Vector2(-29, -2), Vector2(-26, 14), Vector2(-26, 16), Vector2(-11, 29), Vector2(-11, 30), Vector2(13, 28), Vector2(15, 28), Vector2(28, -1), Vector2(29, -1), Vector2(21, -20), Vector2(21, -22), Vector2(-6, -29), Vector2(-6, -28)])] |
@jgrauman0 The backslashes at the end of lines are redundant here, since the code is already surrounded by either parentheses or brackets. |
@jgrauman0 (edited your example data to be more readable)
It's a separate C++ module which has to be compiled as part of the engine, so you'd have to learn how to compile the engine itself first. You can also refer to module's documentation I've written specifically for Goost: https://goost.readthedocs.io/en/gd3/. Or you can download "nightly build" for testing purposes without having to compile yourself, see "Building" section in https://github.com/goostengine/goost. I haven't written any example projects for this yet unfortunately, could be added to https://github.com/goostengine/goost-examples repository... But if you can replicate the node hierarchy as I've shown above, you may be able to figure out the rest. |
Makes sense, don't know why I did that! |
@Xrayez Thanks. I will give recompiling a try when I get some time. Do you anticipate these features will be included in the upcoming 4.0 release? Ever backported to the 3.2 branch? |
@jgrauman0 I've come up with a proof of concept: deformable.mp4Test project: See "Asteroid" scene which has animation player switching "visibility" of collision shapes doing the clipping operation, effectively morphing the physics geometry at run-time. Also available at Goost examples: goostengine/goost-examples@7bbc713.
I haven't considered proposing these features to be available directly in Godot, but it totally depends on user support requesting those features in their real-life projects. I'm afraid there are too many dependencies for those features to be integrated in Godot as-is, including third-party libraries which are not considered stable. I feel fine having those features in Goost module exclusively since I don't have to go through the review process in Godot to make further improvements and changes, the only difference is that they're not officially maintained (it's mostly me doing most of the work there currently). See related proposal by another user: #200. |
@Xrayez Thanks, I'll take a look. If it's not in Godot, and I wanted to make my game available for different platforms, would that mean compiling Godot and your module for each platform? That might be a show-stopper for me... |
Yes, unfortunately you'd have to learn how to compile for each supported platform of interest. But recently I've went through building Godot myself using official build toolchain/containers, so it's possible that at some point I'm going to release third-party Godot builds with Goost module (except that those binaries won't be signed like official builds, maybe later if the project becomes popular enough). But I wouldn't rely on frequent releases, and I'll be (only?) releasing stable versions of the engine (like But at some point, you may find yourself needing other modules (like Steam integration), so you'd need to learn how to compile the engine anyways if you need custom configuration, or would like to benefit from performance gains for you gameplay logic. That's where using GDNative plugins may be better from the user standpoint, but they are a hell to develop, test, and maintain compared to custom C++ modules. |
@jgrauman0 I've recently released a custom beta Godot build with Goost already compiled, if you'd like to try it out as suggested above, then you can download the binaries at the Goost - Download page. That includes export templates for mostly all officially supported platforms (except UWP, because it's not currently maintained by anyone in Godot). |
Describe the project you are working on:
I am designing a multiplayer 2D Space shooter which extensively uses Normal Maps and Lights to achieve 2.5D.
Describe the problem or limitation you are having in your project:
I have several RigidBody2D items (like asteroids) that are animated using a Sprite (with Spritesheets for the texture and normal maps) and an AnimationPlayer to change the frames. However, I need the CollisionPollygon2D to be animated along with the Sprite so that items will collide with the asteroid properly. I need a way to generate the PoolVector2Array of the CollisionPolygon2D for each frame of the animation.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Currently, Godot can generate a CollisionPolygon2D for a Sprite, but not for a Spritesheet. I suggest that the editor allows generating an array of PoolVector2Arrays, one for each frame of the Spritesheet. Then when the frame changes, Godot can change the the CollisionPolygon2D data as well.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
With my proposal, no changes would be necessary in a client's code, only to the editor. Currently when you select "Create CollisionPolygon2D sibling" under the Sprite menu, when the Sprite is a Spritesheet you simply get an error. I propose that since Godot knows that this sprite is a spritesheet, that it simply generates a whole array of CollisionPolygon2D arrays, one for each frame and handles changing the CollisionPolygon2D data when the frame changes.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This is a very difficult feature to implement without changing the Godot Engine. First you would need an external program to generate the polygon data from a Spritesheet. Then, you would have to save all this data into code, embed this code into your program, and write code to change the CollisionPolygon2D data with each frame. You could no longer use the AnimationPlayer, but would have to animate everything yourself from code. I'm unsure how the physics Engine would react to changing the CollisionPolygon2D data, so other changes to the engine may be necessary.
Is there a reason why this should be core and not an add-on in the asset library?:
I think this could be a very useful feature in all kinds of 2D games. Being able to animate 2D sprites and have the animations mimic physical changes allows all kinds of new interactions in a game. Imagine a spaceship that can animate opening its wings. It would be great if while the animation is playing the extent of the object is correct in the physics engine. Almost any kind of game that animates 2D sprites will benefit from having the correct CollisionPolygon2D.
The text was updated successfully, but these errors were encountered: