Hello
I have a problem. I need to change size of Node2D, but without automatic axis binding(unevenly)
In my Node2D i have a lot of textures, that will needed to be deform - synchronously
My q is how can i change size of Node2D arbitrarily. Like in screenshot is that I uploaded
I’m not sure if you’re asking to deform multiple textures into the same arbitrary shape, or to transform things arbitrarily into a non-pre-defined shape.
For the first case, I think you could create a concavepolygonshape2d or convexpolygonshape2d preset (.tres) that you then set as the object’s shape when you want to deform. This would allow you to pre-create the deformed shape, such as the trapezoid you give in your example screenshot.
Alternatively, you could write a script to create said shape through defining the coordinates of each node in the packedvector2 of the shape. You could then abstract this to create a different shape for each texture you’re deforming by setting its shape type to concavepolygonshape2d, defining the segment parameters, and changing the vector data for each texture individually. You could also create an arbitrarily shaped object through script as above a single time, then assign it as the shape type of each texture you want to deform (solution to problem one again, but in-script).
Sounds good, but I’m not sure I understand you well. Can u some explain what exactly I need to do, or maybe u have link to guide for that(1th variant with a CollisionPolygon2D)
I need to deform my Node2D(or all theyr childs) from rectangle to trapezoid
At this moment I’m trying avoid shaders and focus my attention on the game logic
As seen in the first image below, you can draw the polygon you want using the collisionpolygon2d node. This can help you get the exact shape you want and will automatically write the coordinates into a packedvector2 in the inspect.
Then, you can create a collisionshape2d, set the shape to convexpolygonshape2d, paste your vector, and save the shape as a new .tres, as seen in the second image.
From here, in your script, you should be able to change the shape of other nodes that use the shape class to yoursaved_convexpolygonshape2d with the set_shape(value: Shape2D).
Alternatively, you can create a packedvector2 and change yoursaved_convexpolygon2d to the new packedvector2 through set_point_cloud(point_cloud: PackedVector2Array). This would allow you to dynamically create/set the polygon’s shape as often and as variably as you want by just changing the packedvector2 and resetting the point cloud.
Blockquote
Ur method can’t does that I ask
For more understanding I send u SS of my project. I need change form of my Card, for fictiv perspective
From this