Fixtures

The GameMaker: Studio physics system has a number of functions for defining fixtures which can then be applied to instances.

Before an instance in GameMaker: Studio 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 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 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)


Creating Fixtures

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

  1. physics_fixture_create
  2. physics_fixture_bind
  3. physics_fixture_bind_ext
  4. physics_fixture_set_collision_group
  5. physics_fixture_delete
  6. physics_remove_fixture

Defining Fixture Shapes

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:

  1. physics_fixture_set_box_shape
  2. physics_fixture_set_circle_shape
  3. physics_fixture_set_edge_shape
  4. physics_fixture_set_chain_shape
  5. physics_fixture_set_polygon_shape
  6. physics_fixture_add_point

Fixture Properties

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:

  1. physics_fixture_set_density
  2. physics_fixture_set_friction
  3. physics_fixture_set_linear_damping
  4. physics_fixture_set_angular_damping
  5. physics_fixture_set_restitution
  6. physics_fixture_set_sensor
  7. physics_fixture_set_kinematic
  8. physics_fixture_set_awake

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:

  1. physics_get_friction
  2. physics_get_density
  3. physics_get_restitution
  4. physics_set_friction
  5. physics_set_density
  6. physics_set_restitution
  7. physics_mass_properties


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