<?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[3D - A Flying Drone (Difficulty: 1)]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="key-topics-covered"></a>Key Topics Covered</h2>
<ul>
<li><a href="/topic/5/initializing-a-3d-scene">Initializing 3D scenes</a></li>
<li><a href="/topic/35/speed-of-3d-objects">Setting object speeds</a></li>
<li><a href="/topic/112/adding-models">Using models</a></li>
<li><a href="/topic/37/the-follow-camera">The follow camera</a></li>
</ul>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="introduction"></a>Introduction</h2>
<p dir="auto">In this tutorial, we’ll fly a drone across a scene:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dd23f241-bc95-4cbe-afe3-3a2d525db267.gif" width="470" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-1-initialize-the-3d-scene"></a>Step 1 - Initialize the 3D Scene</h2>
<p dir="auto">Please create a new project, and remove the dog sprite. In the “Empty1” sprite, add the green-flag block and the “<a href="/topic/5/initializing-a-3d-scene">initialize 3D scene</a>” block. Please also choose a scene with some objects in it, such as “Castle”, “City”, “Garden” or “Village”. Note that the “City” and “Village” scenes take a bit longer to load if you have a slow computer.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e7d7f153-cc0d-4534-97b0-2c7f92cdb1f1.png" width="480" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-2-add-a-drone-model"></a>Step 2 - Add a Drone Model</h2>
<p dir="auto">You can add a drone model using the “<a href="/topic/112/adding-models">add model</a>” block. Click the “Please select” input to bring out the model library, then pick any model you like. Note that you need to choose a reasonable height for the drone, so that it is not too big or too small.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/68edd2dc-a9d0-478d-9c80-f0907ce07ea4.gif" width="1000" style="border-radius:5px;border:1px solid #29622d" /><br />
 <br />
Note that it is faster to click this block to run it alone. If you attach it to the “initialize 3D scene” block and run them together, then it will take longer.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-3-add-a-follow-camera"></a>Step 3 - Add a “Follow” Camera</h2>
<p dir="auto">Since the drone will be flying around, we can not use a camera that stays at the same location. Instead, we need to use a “<a href="/topic/37/the-follow-camera">follow camera</a>”, which follows a target object wherever it goes.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f2856b6f-1f5e-4ad4-9a12-3e27a74bfe1d.png" width="1000" style="filter:drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5))" /><br />
 <br />
Note that you need to <strong>set the “direction lock” to “Target”</strong>, so that the camera will always face the same direction as the drone.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-4-make-a-new-block-for-handle-keys"></a>Step 4 - Make a New Block for “Handle Keys”</h2>
<p dir="auto">To keep all the key-handling logic in one place, let’s first make a new block called “handle keys”. You can pick a new color for your block as well.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/231290d2-0ac3-4c88-a559-257c9a39adcc.gif" width="1000" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-5-rise-when-the-e-key-is-pressed"></a>Step 5 - Rise when the “e” key is pressed</h2>
<p dir="auto">Now let’s make the drone rise when the “e” key is pressed, and make it stop when no key is pressed. We need a “forever” loop to keep checking if the “e” key is pressed. To make the drone rise or stop, we can set the “<a href="/topic/35/speed-of-3d-objects">rising speed</a>” to 400 or 0.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b96cea20-32be-4c72-b7a6-2587ad3801b2.png" width="350" /><br />
 <br />
Here is what you would get when pressing the “e” key:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/80b6bace-3836-45dd-acdf-e9ae45614968.gif" width="480" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-6-fall-when-the-q-key-is-pressed"></a>Step 6 - Fall when the “q” key is pressed</h2>
<p dir="auto">Whenever the “q” key is pressed, we should set the “rising speed” to a negative number, so that the drone will descend down. Can you add that logic?</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d8d8415a-fba7-4c12-bc13-d4a637d9619b.gif" width="470" style="border-radius:5px;border:1px solid #29622d" /><br />
 <br />
Here is how to modify the program:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/de27c81f-fe2d-43fd-b641-04f8cc76d319.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto">One of the benefits of using the “rising speed” is that <strong>the drone will never fall below the ground</strong> (Z position of 0). Please give it a try.</p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-7-turn-the-drone-left-on-a-key"></a>Step 7 - Turn the Drone Left on “a” key</h2>
<p dir="auto">Whenever the “a” key is pressed, we should turn the drone left by setting the “Z Rotation” speed. Similarly, when no key is pressed, we should reset the z rotation speed to 0:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/025e6399-8d14-4f60-a5a8-d30421a4b95a.png" width="400" /><br />
 <br />
Note that this new “if-else” branch should be stacked below the previous one, because the logic for handling rotation speed and rising speed do not depend on each other. For example, the drone can be rising and turning at the same time.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b9d509be-e477-4704-8873-74c079f9592f.gif" width="470" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-8-turn-right-on-the-d-key"></a>Step 8 - Turn right on the “d” key</h2>
<p dir="auto">Next, can you try to make the drone turn right when the “d” key is pressed?</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/383df6bb-67e4-4c7f-be8f-23d1a5197b45.gif" width="470" style="border-radius:5px;border:1px solid #29622d" /><br />
 <br />
Here is one way to do it. We just need to set its “z rotation” to 100 instead of -100.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9e818230-a580-4df2-ae79-3bbb0dd13ccd.png" width="400" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="step-9-w-and-s-for-going-forward-and-backward"></a>Step 9 - “w” and “s” for going forward and backward</h2>
<p dir="auto">Lastly, we need to add 2 more keys: “w” for making the drone fly forward, and “s” for flying backward. You can set the “forward speed” to a positive or negative number.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dd23f241-bc95-4cbe-afe3-3a2d525db267.gif" width="470" style="border-radius:5px;border:1px solid #29622d" /><br />
 <br />
Here is how to add the new blocks:</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ade1cce0-4864-42c5-b020-2e3770cb6559.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> <br />
Here is the final program for your reference.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/90ee5b04-f809-48c2-a992-c906da44a7b3.png" width="1000" style="filter:drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5))" /></p>
<p dir="auto"> <br />
<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b081e99f-8fab-488a-8bdf-f2791e90cc4f.png" width="350" style="filter:drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5))" /></p>
<p dir="auto"> <br />
 </p>
<h2><a class="anchor-offset" name="creative-ideas"></a>Creative Ideas</h2>
<p dir="auto">There are many ways you can extend this project. Here are some ideas for your inspiration:</p>
<ol>
<li>
<p dir="auto"><strong>Change the drone</strong>: you can select some other model to fly around, and you can update its <a href="/topic/136/update-object-colors">color</a> and <a href="/topic/147/update-object-textures">texture</a>.</p>
</li>
<li>
<p dir="auto"><strong>Treasure Hunt</strong>: you can place some reward items inside the scene, and make the player try to find them.</p>
</li>
</ol>
]]></description><link>https://forum.creaticode.com/topic/323/3d-a-flying-drone-difficulty-1</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 15:08:58 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/323.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Jul 2022 11:44:45 GMT</pubDate><ttl>60</ttl></channel></rss>