Where possible, apply_transformation, instead of regenerating the entire shape again, modifies the points in the shape. It may still regenerate the shape in certain cases where it is impossible to simply move around the shapes to get the desired effect. It allows options for scaling width and corner_size or not (true by default).
It is generally faster than regenerating the entire shape.
There are certain caveats with its use.
The method does not account for corner_size being limited due to smaller-than-expected side lengths. This causes errors in the transformation making it not accurate when this occurs in the original or transformed shape.
Certain cases for RegularCollisionPolygon2D simply regenerate the shape when it should be possible to modify it. They remain because they are edge cases, I'm lazy, and because I don't think changing collision shapes has too much of a use anyways.
Where possible,
apply_transformation
, instead of regenerating the entire shape again, modifies the points in the shape. It may still regenerate the shape in certain cases where it is impossible to simply move around the shapes to get the desired effect. It allows options for scalingwidth
andcorner_size
or not (true by default).It is generally faster than regenerating the entire shape.
There are certain caveats with its use.
RegularCollisionPolygon2D
simply regenerate the shape when it should be possible to modify it. They remain because they are edge cases, I'm lazy, and because I don't think changing collision shapes has too much of a use anyways.