physics_fixture_set_polygon_shape

This function sets the shape of the fixture to that of a polygon.

Syntax:

GML Code Example

physics_fixture_set_polygon_shape(fixture)


Argument Description
fixture the index of the fixture


Returns: N/A


Description

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.


Example:

GML Code Example

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.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here