<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Move 3d object in direction it faces]]></title><description><![CDATA[<p dir="auto">So I've set up a little game where you have a basic player and I can rotate it with <code>c.lx</code> but when I push up with <code>c.ly</code> then it goes in a fixed direction I've even used the 3d tutorials but to no avail</p>
]]></description><link>http://fuzearena.com/forum//topic/2046/move-3d-object-in-direction-it-faces</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Mar 2026 15:27:49 GMT</lastBuildDate><atom:link href="http://fuzearena.com/forum//topic/2046.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Oct 2022 02:48:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 17:24:32 GMT]]></title><description><![CDATA[<p dir="auto">Awesome it works perfectly now thanks</p>
]]></description><link>http://fuzearena.com/forum//post/18811</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18811</guid><dc:creator><![CDATA[poof92]]></dc:creator><pubDate>Thu, 20 Oct 2022 17:24:32 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 16:59:42 GMT]]></title><description><![CDATA[<p dir="auto">If it’s off by 90 degrees or whatever, you can always just bodge it.</p>
<p dir="auto">playerForward = {cos(playerAngle +90 ), 0, sin(playerAngle +90 )}</p>
<p dir="auto">For example.</p>
]]></description><link>http://fuzearena.com/forum//post/18809</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18809</guid><dc:creator><![CDATA[PickleCatStars]]></dc:creator><pubDate>Thu, 20 Oct 2022 16:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 16:16:33 GMT]]></title><description><![CDATA[<p dir="auto">It works for the most part but the object doesn't move towards its face.</p>
<p dir="auto"></p><blockquote class="content twitter-tweet" lang="en"><a href="https://twitter.com/mike97137/status/1583129352581308417?t=y16cczFszMopWMTAx_80ww&amp;s=19"></a></blockquote><p></p>
]]></description><link>http://fuzearena.com/forum//post/18808</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18808</guid><dc:creator><![CDATA[poof92]]></dc:creator><pubDate>Thu, 20 Oct 2022 16:16:33 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 15:04:28 GMT]]></title><description><![CDATA[<p dir="auto">Awesome thanks so much I'll give it a try</p>
]]></description><link>http://fuzearena.com/forum//post/18807</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18807</guid><dc:creator><![CDATA[poof92]]></dc:creator><pubDate>Thu, 20 Oct 2022 15:04:28 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 12:33:51 GMT]]></title><description><![CDATA[<p dir="auto">@toxibunny I second, third and fourth this idea! What a perfect application!</p>
]]></description><link>http://fuzearena.com/forum//post/18806</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18806</guid><dc:creator><![CDATA[Dave]]></dc:creator><pubDate>Thu, 20 Oct 2022 12:33:51 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 10:16:12 GMT]]></title><description><![CDATA[<p dir="auto">You could use that side vector to shoot missiles out of the side of your car.</p>
]]></description><link>http://fuzearena.com/forum//post/18805</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18805</guid><dc:creator><![CDATA[PickleCatStars]]></dc:creator><pubDate>Thu, 20 Oct 2022 10:16:12 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 09:12:08 GMT]]></title><description><![CDATA[<p dir="auto">The above is correct - but we can make something useful here which is referred to as a forward vector. This is a calculated direction vector which takes the sin() and cos() of the player angle into account - and it can be used to get other useful vectors as well, such as the 'side' vector - which describes the direction to the left and right of the forward (think holding your arms out in a T shape).</p>
<p dir="auto">For this I'll assume you have a vector to describe the player position as opposed to separate x, y and z variables.</p>
<pre><code>// You might also want something to adjust the angle the player is facing, for example the right stick X axis:
playerAngle += c.rx

playerForward = {cos(playerAngle), 0, sin(playerAngle)} // 0 on the Y axis assuming you don't want to fly around but move on the ground.
playerPos += playerFoward * c.ly // Add the player forward vector to player position, using the controller Y axis value as a modifier.
</code></pre>
<p dir="auto">You will likely need to modify the controller variables (.ly/.rx etc) to make the numbers move nicely in your project, depending on the scale of things and such. Usually multiplying them by zero point something is a good place to start.</p>
<p dir="auto">To get the side vector, we can take the cross product of the player forward vector and the pure Y axis. This would give us left and right movement, mapped to something like the left stick X axis this creates complete movement!</p>
<pre><code>playerSide = cross(playerForward, {0, 1, 0})
playerPos += playerSide * c.lx
</code></pre>
<p dir="auto">Apologies if it's more info than needed, but just wanted to make sure you had this to refer to if you require it!</p>
]]></description><link>http://fuzearena.com/forum//post/18803</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18803</guid><dc:creator><![CDATA[Dave]]></dc:creator><pubDate>Thu, 20 Oct 2022 09:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to Move 3d object in direction it faces on Thu, 20 Oct 2022 09:12:24 GMT]]></title><description><![CDATA[<p dir="auto">sin() and cos() are probably what you want to use here. Fuze even has a sincos() function that’ll do them both at once.</p>
<p dir="auto">Assuming a fixed camera, and if I’m remembering correctly, If you do something like</p>
<pre><code>Player.x += sin(player.angle)*c.ly
Player.z += cos(player.angle)*c.ly
</code></pre>
<p dir="auto">That should at least give you an idea to get you started...</p>
]]></description><link>http://fuzearena.com/forum//post/18802</link><guid isPermaLink="true">http://fuzearena.com/forum//post/18802</guid><dc:creator><![CDATA[PickleCatStars]]></dc:creator><pubDate>Thu, 20 Oct 2022 09:12:24 GMT</pubDate></item></channel></rss>