Fixtures

Before an instance in GameMaker Studio 2 can have physical properties it must have a fixture assigned to it. A fixture binds a shape or form to the instance and this adds material properties such as density, friction, and restitution. Fixtures can be boxes, circles, polygons or any other simple shape you wish as GameMaker Studio 2 provides functions that enable you to define your own shape point by point, and then once you have your shape you can go ahead and define its physical properties too. These properties are what govern the way the instance with the fixture assigned to it will react with other instance in the physics world and are listed below:

So as you can see, with just a few simple functions, GameMaker Studio 2 can help you to create complex systems and interactions which will give your games an unprecedented sense of realism.

NOTE: You can define one fixture and have it bound to multiple instances (think of a pool table, where all the balls have the same physical properties, yet each one is a discreet entity).

The following functions are for creating, binding, setting collisions and then deleting fixtures:


A fixture must be given a shape or else it will not be detected by the physics world, and this shape can be defined by the following functions:


In order for your physics enabled instance to react properly to the world around it, the fixtures you use must have specific properties defined that will give the fixture bounce, friction, mass etc... The following functions are used to set these properties of the fixture:

You can also set certain properties of the fixture after it has been bound to an instance. When binding the "base" fixture, you can choose to store the unique index for the bound physical properties in a variable. This can then be used in the following functions to change certain properties, or to get the current values for them:


Back: Physics Functions
Next: Joints
© Copyright YoYo Games Ltd. 2018 All Rights Reserved