gm-docs-parser 1.0.0

A collection of typings for GameMaker Studio 2 manual pages
Documentation
<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>

  <script type="text/javascript" language="JavaScript">
    //<![CDATA[
    function reDo() {
      if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
    }
    if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
      origWidth = innerWidth;
      origHeight = innerHeight;
      onresize = reDo;
    }
    onerror = null;
  //]]>
  </script>
  <style type="text/css">/*<![CDATA[*/

    < !-- div.WebHelpPopupMenu {
      position: absolute;
      left: 0px;
      top: 0px;
      z-index: 4;
      visibility: hidden;
    }

    p.WebHelpNavBar {
      text-align: right;
    }

    -->
  
/*]]>*/</style>

  <script type="text/javascript">//<![CDATA[

    gRootRelPath = "../../../..";
    gCommonRootRelPath = "../../../..";
    gTopicId = "9.2.11.3";
  
//]]></script>

  <script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/common.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script>
  <link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"/>
  <link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"/>
  <meta name="topic-status" content="Draft"/>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Fixtures</title>
  <meta name="generator" content="Adobe RoboHelp 2019"/>
  <link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"/>
  <meta name="rh-authors" content="Mark Alexander"/>
  <meta name="topic-comment" content="Reference section for Physics Fixture functions"/>
  <meta name="rh-index-keywords" content=""/>
  <meta name="search-keywords" content="Fixtures,Density,Friction,Linear Damping,Angular Damping,Restitution"/>
</head>

<body>
  <div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
    <div class="logo">
    </div>
    <div class="nav">
      <div class="title" title="Fixtures">
        <span>Fixtures</span>
      </div>
      <div class="gotohome" title="Click here to see this page in full context">
        <span>Click here to see this page in full context</span>
      </div>
    </div>
  </div>
  <div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>







  <!--<div class="body-scroll" style="top: 150px;">-->
  <h1>Fixtures</h1>
  <p>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:</p>
  <ul class="colour">
    <li><b>Density:</b> A material&#39;s density is defined as its mass per unit volume. It is, essentially, a measurement of how tightly matter is crammed together. If you wish your fixture to be <i>static</i> (ie:
      immovable) then the density should be set to 0, essentially making it infinitely dense. <i>Kinematic</i> objects that move with constant velocity and are not physically affected by collisions are also defined using a density
      of 0.</li>
    <li><b>Friction:</b> Friction is the force resisting the relative motion of solid surfaces, fluid layers, and material elements sliding against each other.</li>
    <li><b>Linear Damping:</b> This is the generalised force that causes a moving object to lose momentum. In the &quot;real world&quot; things don&#39;t generally happen forever. For example, A paper airplane will fly for a short while but eventually
      it will fall due to the air friction that acts upon it causing it to slow down. In the physics world that we create such things are difficult to model and so each fixture is given its own linear damping to simulate this type of &quot;generalised
      friction&quot;.</li>
    <li><b>Angular Damping:</b> As above, this is a generalised force that is applied to an object to stop it spinning eternally.</li>
    <li><b>Restitution:</b> In physics, restitution is defined as &quot;the return of an object or system to its original state after elastic deformation&quot;, but as the fixtures in the GameMaker Studio 2 are
      really rigid bodies and cannot be deformed, think of this as basically how &quot;bouncy&quot; the fixture is.</li>
  </ul>
  <p>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.</p>
  <p class="note"><b>NOTE: </b>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). You can also bind multiple fixtures to a
    single instance and combine the physical properties (for example, using two triangular polygon fixtures to create a star)</p>
  <p>The following functions are for creating, binding, setting collisions and then deleting fixtures:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="physics_fixture_create.htm">physics_fixture_create</a></li>
    <li><a href="physics_fixture_bind.htm">physics_fixture_bind</a></li>
    <li><a href="physics_fixture_bind_ext.htm">physics_fixture_bind_ext</a></li>
    <li><a href="physics_fixture_set_collision_group.htm">physics_fixture_set_collision_group</a></li>
    <li><a href="physics_fixture_delete.htm">physics_fixture_delete</a></li>
    <li><a href="physics_remove_fixture.htm">physics_remove_fixture</a></li>
  </ul>
  <p> </p>
  <p>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:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="physics_fixture_set_box_shape.htm">physics_fixture_set_box_shape</a></li>
    <li><a href="physics_fixture_set_circle_shape.htm">physics_fixture_set_circle_shape</a></li>
    <li><a href="physics_fixture_set_edge_shape.htm">physics_fixture_set_edge_shape</a></li>
    <li><a href="physics_fixture_set_chain_shape.htm">physics_fixture_set_chain_shape</a></li>
    <li><a href="physics_fixture_set_polygon_shape.htm">physics_fixture_set_polygon_shape</a></li>
    <li><a href="physics_fixture_add_point.htm">physics_fixture_add_point</a></li>
  </ul>
  <p> </p>
  <p>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:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="physics_fixture_set_density.htm">physics_fixture_set_density</a></li>
    <li><a href="physics_fixture_set_friction.htm">physics_fixture_set_friction</a></li>
    <li><a href="physics_fixture_set_linear_damping.htm">physics_fixture_set_linear_damping</a></li>
    <li><a href="physics_fixture_set_angular_damping.htm">physics_fixture_set_angular_damping</a></li>
    <li><a href="physics_fixture_set_restitution.htm">physics_fixture_set_restitution</a></li>
    <li><a href="physics_fixture_set_sensor.htm">physics_fixture_set_sensor</a></li>
    <li><a href="physics_fixture_set_kinematic.htm">physics_fixture_set_kinematic</a></li>
    <li><a href="physics_fixture_set_awake.htm">physics_fixture_set_awake</a></li>
  </ul>
  <p> </p>
  <p>You can also set certain properties of the fixture <i>after</i> it has been bound to an instance. When binding the &quot;base&quot; 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:</p>
  <p> </p>
  <ul class="colour">
    <li><a href="physics_get_friction.htm">physics_get_friction</a></li>
    <li><a href="physics_get_density.htm">physics_get_density</a></li>
    <li><a href="physics_get_restitution.htm">physics_get_restitution</a></li>
    <li><a href="physics_set_friction.htm">physics_set_friction</a></li>
    <li><a href="physics_set_density.htm">physics_set_density</a></li>
    <li><a href="physics_set_restitution.htm">physics_set_restitution</a></li>
    <li><a href="../physics_mass_properties.htm">physics_mass_properties</a></li>
  </ul>
  <p> </p>
  <p> </p>
  <p> </p>
  <div class="footer">
    <div class="buttons">
      <div class="clear">
        <div style="float:left">Back: <a href="../Physics.htm">Physics</a></div>
        <div style="float:right">Next: <a href="../Joints/Joints.htm">Joints</a></div>
      </div>
    </div>
    <h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
  </div>
  <!-- KEYWORDS
Fixtures
-->
  <!-- TAGS
physics_fixture_functions
-->

</body></html>