<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript" language="JavaScript">
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">
< !-- div.WebHelpPopupMenu {
position: absolute;
left: 0px;
top: 0px;
z-index: 4;
visibility: hidden;
}
p.WebHelpNavBar {
text-align: right;
}
-->
</style>
<script type="text/javascript">
gRootRelPath = "../../../..";
gCommonRootRelPath = "../../../..";
gTopicId = "9.2.11.6";
<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>Physics Variables</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 Variables"/>
<meta name="rh-index-keywords" content=""/>
<meta name="search-keywords" content="Physics Variables"/>
</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="Physics Variables">
<span>Physics Variables</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>
<h1>Physics Variables</h1>
<p>As with the "traditional" collisions and movement system, the physics system also has a series of <a href="../../Asset_Management/Instances/Instance_Variables/Instance_Variables.htm">instance variables</a> assigned to each instance of an object
when it is created. Some of these properties can be defined by the user in GML, but many are read-only and still more are only applicable in the <strong>collision</strong> event.</p>
<p>The following variables exists in <i>all</i> physics enabled objects and they can be read from and written to (ie: changed) using code from instances and script functions:</p>
<p> </p>
<ul class="colour">
<li><a href="phy_active.htm">phy_active</a></li>
<li><a href="phy_angular_velocity.htm">phy_angular_velocity</a></li>
<li><a href="phy_angular_damping.htm">phy_angular_damping</a></li>
<li><a href="phy_linear_velocity_x.htm">phy_linear_velocity_x</a></li>
<li><a href="phy_linear_velocity_y.htm">phy_linear_velocity_y</a></li>
<li><a href="phy_linear_damping.htm">phy_linear_damping</a></li>
<li><a href="phy_speed_x.htm">phy_speed_x</a></li>
<li><a href="phy_speed_y.htm">phy_speed_y</a></li>
<li><a href="phy_position_x.htm">phy_position_x</a></li>
<li><a href="phy_position_y.htm">phy_position_y</a></li>
<li><a href="phy_position_xprevious.htm">phy_position_xprevious</a></li>
<li><a href="phy_position_yprevious.htm">phy_position_yprevious</a></li>
<li><a href="phy_rotation.htm">phy_rotation</a></li>
<li><a href="phy_fixed_rotation.htm">phy_fixed_rotation</a></li>
<li><a href="phy_bullet.htm">phy_bullet</a></li>
</ul>
<p> </p>
<p>Certain variables are <b>read-only</b> variables, which means that the information they contain cannot be changed through instance code or script funcions (but it <i>can</i> be changed internally by GameMaker Studio 2 which
is why these are variables and not <b>constants</b>). The following list shows the <b>read-only</b> variables that exist in <i>all</i> physics enabled objects:</p>
<p> </p>
<ul class="colour">
<li><a href="phy_speed.htm">phy_speed</a></li>
<li><a href="phy_com_x.htm">phy_com_x</a></li>
<li><a href="phy_com_y.htm">phy_com_y</a></li>
<li><a href="phy_dynamic.htm">phy_dynamic</a></li>
<li><a href="phy_kinematic.htm">phy_kinematic</a></li>
<li><a href="phy_inertia.htm">phy_inertia</a></li>
<li><a href="phy_mass.htm">phy_mass</a></li>
<li><a href="phy_sleeping.htm">phy_sleeping</a></li>
</ul>
<p> </p>
<p>Finally, there are a number of temporary variables that exist in physics enabled objects and are created <i>only in the collision event</i>. These variables are like those listed above and are <b>read-only</b>:</p>
<p> </p>
<ul class="colour">
<li><a href="phy_collision_points.htm">phy_collision_points</a></li>
<li><a href="phy_collision_x.htm">phy_collision_x</a></li>
<li><a href="phy_collision_y.htm">phy_collision_y</a></li>
<li><a href="phy_col_normal_x.htm">phy_col_normal_x</a></li>
<li><a href="phy_col_normal_y.htm">phy_col_normal_y</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="../The_Physics_World/The_Physics_World.htm">The Physics World</a></div>
</div>
</div>
<h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
</div>
</body></html>