Having a hard time understanding the PackedVector2A size

image

I’m not able to understand what the x and y access here represents on the repeating polygon shape. Can anybody provide me some guidance please?

Hi Walid,

To expand slightly the PackedVector2A is actually a PackedVector2Array which is an array of Vector2’s that are stored.
In this we have 4 Vector2’s (We start counting from 0 remember) so the x and y values are the position of that vector2.

Hope that helps

And with a csg polygon3d, the x and y coordinates represent a side 2d view of the shape with ots 0,0 being with respect to the local position of the csgpolygon. And the points being at an offset from there.
The csgpoly depth property acts as the third dimension, basically extruding that 2d shape to flesh out the 3d shape.

1 Like

One thing that helped me is picking up on there word “extrude” which is a 3D modeling term…

Pretend you are looking straight ahead at the path you just created. That path represents 0,0 for these purposes.

So the polygon coordinates are actually the “corners”… Bottom Left, Top Left, Top Right, Bottom Right

So drawing a square polygon centered around our path line as the 0,0 coordinate would be

-1,-1
-1,1
1,1
1,-1

This will then extrude that shape, based on those 4 coordinates, all along the path, with the path as the 0,0 reference center point.

2 Likes

Think of this as looking at a standard graph with an X and Y axis. Ignore the whole polygon 3d path etc for the moment.
First point is (0,0) (0 on the x axis, 0 on the y)
Second point is (1,0) (1 on the x axis, 0 on the y)
Third point is (1,1) (1 on the x axis, 1 on the y axis)
Forth point is (0,1) (0 on the x axis, 1 on the y axis)

If you were to then draw draw a line from 1st > 2nd > 3rd > 4th > 1st points you have just drawn a square.

That is what the packedvector2A has drawn with those points. Then to make the actual path, it starts putting copies and copies of that square stacked behind each other to make the 3d shape. Just like if you drew the shape on every sheet of a ream of paper and then stacked them together to make a 3d shape.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms