<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E5%82%B2%E5%A8%87%E7%8C%AA%E7%9A%AE</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E5%82%B2%E5%A8%87%E7%8C%AA%E7%9A%AE"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/%E5%82%B2%E5%A8%87%E7%8C%AA%E7%9A%AE"/>
	<updated>2026-04-15T04:26:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43258</id>
		<title>Quaternion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43258"/>
		<updated>2014-12-11T08:27:13Z</updated>

		<summary type="html">&lt;p&gt;傲娇猪皮: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Quaternion is used to define the rotation angle by GTA:SA game engine, which is different from MTASA which is based on Euler angle&lt;br /&gt;
This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is non-mtasa function, user need to put this function in your lua scripts.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float fromQuaternion ( rotx,roty,rotz,rotw)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''rotx,roty,rotz,rotw''': The quaternion from IPL file&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* '''rotx,roty,rotz''': The Euler angle&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function fromQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function fromQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local rotx, roty, rotx, rotw = 233,666,888,999  -- you can read the Quaternion from IPL file&lt;br /&gt;
createObject ( 1337, 5540.6654, 1020.55122, 1240.545,fromQuaternion(rotx, roty, rotx, rotw))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: KawaNoII (http://www.chinesemta.com)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>傲娇猪皮</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43257</id>
		<title>Quaternion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43257"/>
		<updated>2014-12-11T08:26:02Z</updated>

		<summary type="html">&lt;p&gt;傲娇猪皮: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Quaternion is used to define the rotation angle by GTA:SA game engine, which is different from MTASA which is based on Euler angle&lt;br /&gt;
This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is non-mtasa function, user need to put this function in your lua scripts.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float fromQuaternion ( rotx,roty,rotz,rotw)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''rotx,roty,rotz,rotw''': the quaternion from IPL file&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* '''rotx,roty,rotz''': the Euler angle&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function fromQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function fromQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local rotx, roty, rotx, rotw = 233,666,888,999  -- you can read the Quaternion from IPL file&lt;br /&gt;
createObject ( 1337, 5540.6654, 1020.55122, 1240.545,fromQuaternion(rotx, roty, rotx, rotw))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: KawaNoII (http://www.chinesemta.com)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>傲娇猪皮</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43256</id>
		<title>Quaternion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43256"/>
		<updated>2014-12-11T08:24:29Z</updated>

		<summary type="html">&lt;p&gt;傲娇猪皮: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Quaternion is used to define the rotation angle by GTA:SA game engine, which is different from MTASA which is based on Euler angle&lt;br /&gt;
This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is non-mtasa function, user need to put this function in your lua scripts.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float toQuaternion ( rotx,roty,rotz,rotw)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''rotx,roty,rotz,rotw''': the quaternion from IPL file&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* '''rotx,roty,rotz''': the Euler angle&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function math.arad(number)&lt;br /&gt;
	if type(number) == &amp;quot;number&amp;quot; then&lt;br /&gt;
		return (number/(math.pi*2))*360&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local rotx, roty, rotx, rotw = 233,666,888,999  -- you can read the Quaternion from IPL file&lt;br /&gt;
createObject ( 1337, 5540.6654, 1020.55122, 1240.545,toQuaternion(rotx, roty, rotx, rotw))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: KawaNoII (http://www.chinesemta.com)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>傲娇猪皮</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43255</id>
		<title>Quaternion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43255"/>
		<updated>2014-12-11T08:17:19Z</updated>

		<summary type="html">&lt;p&gt;傲娇猪皮: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Quaternion is used to define the rotation angle by GTA:SA game engine, which is different from MTASA which is based on Euler angle&lt;br /&gt;
This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is non-mtasa function, user need to put this function in your lua scripts.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float toQuaternion ( rotx,roty,rotz,rotw)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''rotx,roty,rotz,rotw''': the quaternion from IPL file&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* '''rotx,roty,rotz''': the Euler angle&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local rotx,roty,rotz = toQuaternion(x,y,z,w)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: KawaNoII (http://www.chinesemta.com)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>傲娇猪皮</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43254</id>
		<title>Quaternion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Quaternion&amp;diff=43254"/>
		<updated>2014-12-11T08:13:05Z</updated>

		<summary type="html">&lt;p&gt;傲娇猪皮: Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt; __NOTOC__ This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is no...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;Quaternion&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the Euler angle(rotx,roty,rotz) from quaternion(rotx,roty,rotz,rotw).this is non-mtasa function, user need put this function in your lua scripts.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float toQuaternion ( rotx,roty,rotz,rotw)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''rotx,roty,rotz,rotw''': the quaternion from IPL file&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* '''rotx,roty,rotz''': the Euler angle&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toQuaternion(x,y,z,w)&lt;br /&gt;
	local heading = math.atan2(2*(w*x+y*z),1-2*(x^2+y^2))&lt;br /&gt;
	local attitude = math.asin(w*y-z*x) &lt;br /&gt;
	local bank = math.atan2(2*(w*z+x*y),1-2*(y^2+z^2))&lt;br /&gt;
	return math.arad(heading),math.arad(attitude),math.arad(bank)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local rotx,roty,rotz = toQuaternion(x,y,z,w)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: KawaNoII (http://www.chinesemta.com)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>傲娇猪皮</name></author>
	</entry>
</feed>