What Are Physics Properties in GameMaker: Studio?

By Michael Rohde

GameMaker: Studio allows you to add physics properties to objects in your game. Here’s a quick list of the different physics properties that you use when setting up your Object:

  • Density: Defines how many molecules are packed into the fixture. Think of a box full of feathers and a box full of books — they both look the same size but the one with the feathers is less dense (and so has less mass) than the one with the books.

    Changing this value will affect the overall mass of your fixture. For a quick and responsive effect, you would want the density low (for example, a value of 0.15).

  • Restitution: Defines the bounce of the fixture. A high restitution value means that the Object will bounce a lot when in a collision, and a low restitution value means it will only bounce a little.

  • Collision group: This feature enables you to create groups of fixtures, with the default group being 0. If you have two or more fixtures with a negative collision group (for example, a value of -1), these fixtures will never collide, even if they have a Collision Event set up.

    If you assign two or more fixtures to a positive collision group (for example, a value of 1), they’ll always collide, whether they have a Collision Event or not. The default is 0, which means that they’ll collide if they have a Collision Event.

    Using collision groups is a processor-heavy task and should only be used when absolutely necessary.

  • Linear damping: When you throw something, it doesn’t keep going forever because the friction against the air slows it down and eventually stops it (gravity works in this way, too). Linear damping gives Objects a kind of drag or friction in the Room. To make an Object slow down quickly, set this value to 0.5.

  • Angular damping: Differs from linear damping in that it affects rotation instead of direction. If this is set to 0, any bump or movement that affects the angular rotation of the fixture will continue infinitely. To make the Object responsive to the player, set this value to 0.5.

  • Friction: Determines how quickly an Object slows down when its speed is greater than zero (can be negative or positive). For example, if the Friction is set to 0.1 and the speed of the Instance is 1 (1 pixel per step), the Instance will slow down and stop after ten steps.

  • Sensor: Select this box to ignore the physical properties of the Object but still trigger a Collision Event with the Objects around it. This enables you to have an Instance with no physical presence in the Room, but the Instance can still react to collisions of other Instances and do something in turn.

  • Start awake: Represents the initial state of the fixture, and the default is awake. When an Object is awake, it’s considered part of the physics world. However, if for some reason this interferes with how your game starts, you deselect this option so that the Object starts off asleep, and it does not participate in the physics world unless something acts upon it.

  • Kinematic: If you select Kinematic, the Object will be unaffected by collisions and gravity, but it can still be moved around or rotated using the appropriate values. A Kinematic Object is considered a static Object that happens to move; in contrast, a static Object has a density of 0 and you can position it at any absolute point in the Room.

    image0.jpg

All these properties behave differently depending on the mass of the fixture. The mass is calculated by GameMaker, based on the surface area of the fixture and the density.