physics_fixture_set_polygon_shape


描述

This function sets a polygon shape for your fixture, but you will need to use physics_fixture_add_point to actually define the shape of this polygon relative to the origin of the fixture. The polygon is closed when the fixture is bound to an instance. You should note too that this function must be called before defining any points, and you must also have at least three points defined for your polygon before binding it to an instance or you will get an error.


语法:

physics_fixture_set_polygon_shape(fixture)

参数 描述
fixture the index of the fixture


返回:

N/A(无返回值)


例如:

physics_fixture_set_polygon_shape(fix_Ship);
physics_fixture_add_point(fix_Ship, 0,0);
physics_fixture_add_point(fix_Ship, -40, 100);
physics_fixture_add_point(fix_Ship, 40, 100);

The code above will apply a polygon shape to the fixture indexed in the variable "fix_Ship" and then defines three points to create a triangular shape.