{"id":97,"date":"2019-03-24T11:22:16","date_gmt":"2019-03-24T11:22:16","guid":{"rendered":"http:\/\/evertechsandbox.com\/?p=97"},"modified":"2019-03-24T15:56:57","modified_gmt":"2019-03-24T15:56:57","slug":"mod-api-update-0-27","status":"publish","type":"post","link":"https:\/\/evertechsandbox.com\/?p=97","title":{"rendered":"Mod API update 0.27.*"},"content":{"rendered":"<h3>Mod API update 0.27.*<\/h3>\n<p>Added methods for rotation.<\/p>\n<p><!--more--><\/p>\n<p>es.Root.Rigidbody.Rotation = {x,y,z,w}<\/p>\n<div class=\"subsection\">\n<p>Quaternions are used to represent rotations.<\/p>\n<\/div>\n<div class=\"subsection\">\n<p>They are compact, don&#8217;t suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations.<\/p>\n<p>They are based on complex numbers and are not easy to understand intuitively. You almost never access or modify individual Quaternion components (x,y,z,w); most often you would just take existing rotations and use them to construct new rotations (e.g. to smoothly interpolate between two rotations). The Quaternion functions that you use 99% of the time are:\u00a0Quaternion.LookRotation,\u00a0Quaternion.Angle,\u00a0Quaternion.Euler,\u00a0Quaternion.Slerp,\u00a0Quaternion.FromToRotation, and\u00a0Quaternion.identity. (The other functions are only for exotic uses.)<\/p>\n<pre>es.Quaternion - stores methods for working with quaternions<\/pre>\n<p>&nbsp;<\/p>\n<pre>es.Quaternion.Euler(float\u00a0<span class=\"sig-kw\">x<\/span>, float\u00a0<span class=\"sig-kw\">y<\/span>, float\u00a0<span class=\"sig-kw\">z<\/span>)<\/pre>\n<p>Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.<\/p>\n<p>&nbsp;<\/p>\n<pre><span class=\"sig-kw\">Quaternion es.Quaternion.LookRotation<\/span>(Vector3\u00a0<span class=\"sig-kw\">forward<\/span>,\u00a0Vector3\u00a0<span class=\"sig-kw\">upwards<\/span>\u00a0= Vector3.up)<\/pre>\n<div class=\"subsection\">\n<h4>Description<\/h4>\n<p>Creates a rotation with the specified\u00a0<code class=\"varname\">forward<\/code>\u00a0and\u00a0<code class=\"varname\">upwards<\/code>\u00a0directions.<\/p>\n<\/div>\n<div class=\"subsection\">\n<p>Z axis will be aligned with\u00a0<code class=\"varname\">forward<\/code>, X axis aligned with cross product between\u00a0<code class=\"varname\">forward<\/code>\u00a0and\u00a0<code class=\"varname\">upwards<\/code>, and Y axis aligned with cross product between Z and X.<\/p>\n<p>Returns identity if\u00a0<code class=\"varname\">forward<\/code>\u00a0or\u00a0<code class=\"varname\">upwards<\/code>\u00a0magnitude is zero.<br \/>\nReturns identity if\u00a0<code class=\"varname\">forward<\/code>\u00a0and\u00a0<code class=\"varname\">upwards<\/code>\u00a0are colinear.<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"subsection\">\n<div class=\"signature\">\n<pre class=\"signature-CS sig-block\">\u00a0Quaternion\u00a0es.Quaternion.<span class=\"sig-kw\">FromToRotation<\/span>(Vector3\u00a0<span class=\"sig-kw\">fromDirection<\/span>,\u00a0Vector3\u00a0<span class=\"sig-kw\">toDirection<\/span>)<\/pre>\n<\/div>\n<\/div>\n<div class=\"subsection\">\n<h4>Description<\/h4>\n<p>Creates a rotation which rotates from\u00a0<code class=\"varname\">fromDirection<\/code>\u00a0to\u00a0<code class=\"varname\">toDirection<\/code>.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<pre>Vector3 es.Quaternion.ToEulerAngles(Quaternion rotation)<\/pre>\n<h4>Description<\/h4>\n<div class=\"subsection\">\n<p>Returns the euler angle representation of the rotation.<\/p>\n<\/div>\n<div class=\"subsection\">\n<p>A rotation that rotates euler.z degrees around the z axis, euler.x degrees around the x axis, and euler.y degrees around the y axis (in that order).<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<pre>Quaternion es.Quaternion.Inverse(Quaternion rotation)<\/pre>\n<h4>Description<\/h4>\n<p>Returns the Inverse of\u00a0<code class=\"varname\">rotation<\/code>.<\/p>\n<pre>Quaternion es.Quaternion.Multiply(Quaternion a, Quaternion b)<\/pre>\n<h4>Description<\/h4>\n<p>Multiplies two quaternions<\/p>\n<pre>Vector3 es.Quaternion.MultiplyByVector(Quaternion a, Vector3 vector)<\/pre>\n<h4>Description<\/h4>\n<p>Multiplies quaternion by vector and returns vector. use it to rotate vector by rotation a<\/p>\n<pre>es.Root.Rigidbody.Rotation<\/pre>\n<h4>Description<\/h4>\n<p>Sets or gets a rotation of this rigidbody (quaternion)<\/p>\n<p>&nbsp;<\/p>\n<pre>es.Root.Rigidbody.RotateAround(Vector3 point, Vector3 axis, float angle)<\/pre>\n<div class=\"subsection\">\n<h2>Description<\/h2>\n<p>Rotates the transform about\u00a0<code class=\"varname\">axis<\/code>\u00a0passing through\u00a0<code class=\"varname\">point<\/code>\u00a0in world coordinates by\u00a0<code class=\"varname\">angle<\/code>\u00a0degrees.<\/p>\n<\/div>\n<div class=\"subsection\">\n<p>This modifies both the position and the rotation of the transform.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<pre>Transform.Rotation<\/pre>\n<h4>Description<\/h4>\n<p>Gets a rotation of transform (quaternion)<\/p>\n<p>&nbsp;<\/p>\n<pre>es.Root.Transform<\/pre>\n<h4>Description<\/h4>\n<p>returns a transform of the root<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div class=\"subsection\">\n<div class=\"signature\">\n<pre class=\"signature-CS sig-block\">void es.Root.Rigidbody.<span class=\"sig-kw\">AddExplosionForce<\/span>(float\u00a0<span class=\"sig-kw\">explosionForce<\/span>,\u00a0<a href=\"https:\/\/docs.unity3d.com\/ScriptReference\/Vector3.html\">Vector3<\/a>\u00a0<span class=\"sig-kw\">explosionPosition<\/span>, float\u00a0<span class=\"sig-kw\">explosionRadius<\/span>, float\u00a0<span class=\"sig-kw\">upwardsModifier<\/span>\u00a0= 0.0f, int\u00a0<span class=\"sig-kw\">mode<\/span>\u00a0= 0));<\/pre>\n<\/div>\n<\/div>\n<div class=\"subsection\">\n<h2>Parameters<\/h2>\n<table class=\"list\">\n<tbody>\n<tr>\n<td class=\"name lbl\">explosionForce<\/td>\n<td class=\"desc\">The force of the explosion (which may be modified by distance).<\/td>\n<\/tr>\n<tr>\n<td class=\"name lbl\">explosionPosition<\/td>\n<td class=\"desc\">The centre of the sphere within which the explosion has its effect.<\/td>\n<\/tr>\n<tr>\n<td class=\"name lbl\">explosionRadius<\/td>\n<td class=\"desc\">The radius of the sphere within which the explosion has its effect.<\/td>\n<\/tr>\n<tr>\n<td class=\"name lbl\">upwardsModifier<\/td>\n<td class=\"desc\">Adjustment to the apparent position of the explosion to make it seem to lift objects.<\/td>\n<\/tr>\n<tr>\n<td class=\"name lbl\">mode<\/td>\n<td class=\"desc\">The method used to apply the force to its targets.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\/\/<br \/>\n\/\/ Summary:<br \/>\n\/\/ Add a continuous force to the rigidbody, using its mass.<br \/>\nForce = 0,<br \/>\n\/\/<br \/>\n\/\/ Summary:<br \/>\n\/\/ Add an instant force impulse to the rigidbody, using its mass.<br \/>\nImpulse = 1,<br \/>\n\/\/<br \/>\n\/\/ Summary:<br \/>\n\/\/ Add an instant velocity change to the rigidbody, ignoring its mass.<br \/>\nVelocityChange = 2,<br \/>\n\/\/<br \/>\n\/\/ Summary:<br \/>\n\/\/ Add a continuous acceleration to the rigidbody, ignoring its mass.<br \/>\nAcceleration = 5<\/p>\n<\/div>\n<div class=\"subsection\">\n<h2>Description<\/h2>\n<p>Applies a force to a rigidbody that simulates explosion effects.<\/p>\n<\/div>\n<div class=\"subsection\">\n<p>The explosion is modelled as a sphere with a certain centre position and radius in world space; normally, anything outside the sphere is not affected by the explosion and the force decreases in proportion to distance from the centre. However, if a value of zero is passed for the radius then the full force will be applied regardless of how far the centre is from the rigidbody.<\/p>\n<p>By default, the direction of the force is the line going from the explosion centre to the rigidbody&#8217;s centre of mass. If you pass a non-zero value for the\u00a0<code class=\"varname\">upwardsModifier<\/code>parameter, the direction will be modified by subtracting that value from the Y component of the centre point. For example, if you pass a value of 2.0 for\u00a0<code class=\"varname\">upwardsModifier<\/code>, the explosion will appear to be centred 2.0 units below its actual position for purposes of calculating the force direction (ie, the centre and the radius of effect are not modified). Using this parameter, you can easily make the explosion appear to throw objects up into the air, which often gives a more dramatic effect than a simple outward force.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Mod API update 0.27.* Added methods for rotation.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/posts\/97"}],"collection":[{"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":8,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":106,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/106"}],"wp:attachment":[{"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/evertechsandbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}