<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>3D on Godot 4 レシピ</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/index.html</link><description>Recent content in 3D on Godot 4 レシピ</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 09 Dec 2020 20:23:50 -0700</lastBuildDate><atom:link href="https://kamera25.github.io/godot_recipes/4.x/3d/index.xml" rel="self" type="application/rss+xml"/><item><title>Working with 3D Assets</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/assets/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/assets/index.html</guid><description>&lt;h1 id="working-with-3d-assets"&gt;&lt;i class='fas fa-cubes'&gt;&lt;/i&gt; Working with 3D Assets&lt;/h1&gt;
&lt;p&gt;Detailed recipes for importing and working with 3D assets including models, animations, and materials.&lt;/p&gt;
&lt;p&gt;For these examples, we&amp;rsquo;ll be using the following 3d assets from &lt;a href="https://kaylousberg.itch.io/" target="_blank"&gt;Kay Lousberg&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kaylousberg.itch.io/kaykit-adventurers" target="_blank"&gt;Adventurers Character Pack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kaylousberg.itch.io/kaykit-dungeon-remastered" target="_blank"&gt;Dungeon Asset Pack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="in-this-section"&gt;In this section:&lt;/h4&gt;
&lt;ul class="children children-li children-sort-weight"&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/assets/importing_assets/index.html"&gt;Importing Assets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/assets/character_animation/index.html"&gt;Character Animation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/assets/character_controller/index.html"&gt;Character Controller&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Basic FPS Character</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/basic_fps/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/basic_fps/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need to make a first-person shooter (FPS) character.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Start with a &lt;i class="gd-CharacterBody3D"&gt;&lt;/i&gt;&lt;code&gt;CharacterBody3D&lt;/code&gt; node, and add a &lt;i class="gd-CollisionShape3D"&gt;&lt;/i&gt;&lt;code&gt;CollisionShape3D&lt;/code&gt; to it. The &lt;i class="gd-CapsuleShape3D"&gt;&lt;/i&gt;&lt;code&gt;CapsuleShape3D&lt;/code&gt; collision shape is the most common choice. Depending on your world setup, you may want to add additional shapes here, but for the purposes of this example, we&amp;rsquo;ll stick to the basics.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll leave all the sizing at the default values, meaning the capsule will be 2 meters high. Move it up by &lt;code&gt;1.0&lt;/code&gt; m to align its bottom with the ground.&lt;/p&gt;</description></item><item><title>Camera Gimbal</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/camera_gimbal/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/camera_gimbal/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need a camera controller, using mouse or keyboard, that remains level while rotating and following a target.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Try this: take a &lt;i class="gd-Camera3D"&gt;&lt;/i&gt;&lt;code&gt;Camera3D&lt;/code&gt; node and rotate it a small amount around &lt;strong&gt;X&lt;/strong&gt; (the red ring on the gizmo), then a small amount around &lt;strong&gt;Z&lt;/strong&gt; (the blue ring). Now reverse the &lt;strong&gt;X&lt;/strong&gt; rotation and click the &amp;ldquo;Preview&amp;rdquo; button. Observe how the camera is now tilted.&lt;/p&gt;</description></item><item><title>Interpolated Camera</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/interpolated_camera/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/interpolated_camera/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need a 3D camera that smoothly follows a target (interpolates).&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;div class="box notices cstyle info"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-info-circle"&gt;&lt;/i&gt; Info&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;Godot&amp;rsquo;s built-in &lt;code&gt;InterpolatedCamera&lt;/code&gt; node is deprecated and will be removed in the release of Godot 4.0.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Attach the script below to a &lt;i class="gd-Camera3D"&gt;&lt;/i&gt;&lt;code&gt;Camera3D&lt;/code&gt; node in your scene. The three &lt;code&gt;export&lt;/code&gt; properties let you choose:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lerp_speed&lt;/code&gt; - the camera&amp;rsquo;s movement speed. Lower values result in a &amp;ldquo;lazier&amp;rdquo; camera.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;target&lt;/code&gt; - choose the camera&amp;rsquo;s target node.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;offset&lt;/code&gt; - position of the camera relative to the target.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See below for some examples of the camera in action.&lt;/p&gt;</description></item><item><title>Shooting with Raycasts</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/shooting_raycasts/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/shooting_raycasts/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need to implement shooting in an FPS, but moving individual projectiles is impractical.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Game physics engines often break down when trying to handle very fast-moving objects. The solution is to cast a ray from the shooter&amp;rsquo;s location and detect the first thing that would be hit.&lt;/p&gt;
&lt;p&gt;There are two ways to approach raycasting in Godot: the &lt;i class="gd-RayCast3D"&gt;&lt;/i&gt;&lt;code&gt;RayCast3D&lt;/code&gt; node, or directly casting a ray in space using the physics engine. While they can both accomplish the same thing, each has its uses. The node method tends to be best for situations where you continuously want to check for collisions - a downward-facing ray to check if you&amp;rsquo;re on the floor, for example.&lt;/p&gt;</description></item><item><title>CharacterBody3D: Movement</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/characterbody3d_examples/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/characterbody3d_examples/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need a player-controlled 3D character body.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;For this recipe, we&amp;rsquo;ll be using this adorable tank model:&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-9635a925ca1c72b62f88530b50079bf7" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_kinematic_01.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-9635a925ca1c72b62f88530b50079bf7"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_kinematic_01.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can grab this model on Itch.io: &lt;a href="https://gtibo.itch.io/mini-tank" target="_blank"&gt;https://gtibo.itch.io/mini-tank&lt;/a&gt; or use any other model you&amp;rsquo;d like. We won&amp;rsquo;t be doing anything that&amp;rsquo;s tank-specific here.&lt;/p&gt;
&lt;p&gt;In the case of this asset, the download includes an OBJ file, and we&amp;rsquo;ll find it more convenient if we import it as a scene:&lt;/p&gt;</description></item><item><title>3D Unit Healthbars</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/healthbars/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/healthbars/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want a floating &amp;ldquo;healthbar&amp;rdquo; for your 3D game objects (mobs, characters, etc.).&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;For this solution, we&amp;rsquo;re going to re-use a 2D healthbar based on a &lt;i class="gd-TextureProgressBar"&gt;&lt;/i&gt;&lt;code&gt;TextureProgressBar&lt;/code&gt; node. It&amp;rsquo;s already set up with textures and code for updating the value and color. If you already have something similar, feel free to use it here. In the example, we&amp;rsquo;ll name this scene &amp;ldquo;Healthbar2D&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-1c8439a322a52636ea2baed581b15921" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/healthbar_example.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-1c8439a322a52636ea2baed581b15921"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/healthbar_example.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you need some assets, here are the three images used in the bar:&lt;/p&gt;</description></item><item><title>Shooting projectiles</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/3d_shooting/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/3d_shooting/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to shoot projectiles from your player/mob/etc..&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;For this example, we&amp;rsquo;ll use the &amp;ldquo;Mini Tank&amp;rdquo; that we set up in &lt;a href="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/3d/kinematic_body/"&gt;CharacterBody3D: Movement&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="setting-up-the-bullet"&gt;Setting up the bullet&lt;/h3&gt;
&lt;p&gt;First, we&amp;rsquo;ll set up a &amp;ldquo;bullet&amp;rdquo; object that we can instance. Here are the nodes we&amp;rsquo;ll use:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&lt;i class="gd-Area3D"&gt;&lt;/i&gt; Area3D: Bullet
&lt;i class="gd-MeshInstance3D"&gt;&lt;/i&gt; MeshInstance
&lt;i class="gd-CollisionShape3D"&gt;&lt;/i&gt; CollisionShape
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For your mesh, you can use one of Godot&amp;rsquo;s built-in primitive shapes, or something like this:&lt;/p&gt;</description></item><item><title>Rolling Cube</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/rolling_cube/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/rolling_cube/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to make a rolling cube in 3D.&lt;/p&gt;
&lt;p&gt;&lt;video width="500" controls src="https://kamera25.github.io/godot_recipes/4.x/img/rolling_cube.webm"&gt;&lt;/video&gt;&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Rolling a cube is trickier than it seems. You can&amp;rsquo;t just rotate the cube around its center:&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-5a51c49a0149e5e9c745b01f6f200320" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cube_001.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-5a51c49a0149e5e9c745b01f6f200320"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cube_001.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Instead, the cube needs to be rotated around its bottom edge.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-5fa0c430b25479f6bcd9b458b6253cf8" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cube_002.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-5fa0c430b25479f6bcd9b458b6253cf8"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cube_002.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the tricky part: which bottom edge? It depends on which direction the cube is rolling.&lt;/p&gt;
&lt;p&gt;In preparing this recipe, I experimented with a few different solutions to this problem:&lt;/p&gt;</description></item><item><title>Align Movement with Camera</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/move_with_camera/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/move_with_camera/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;When moving with WASD-style controls in 3D, it&amp;rsquo;s easy to get disoriented if the camera rotates. Whose forward counts - the player&amp;rsquo;s (ie the camera&amp;rsquo;s) or the object in the game world?&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;While this situation can apply to many possible scenarios, we&amp;rsquo;ll use the &lt;a href="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/3d/rolling_cube/"&gt;Rolling Cube recipe&lt;/a&gt; as our example.&lt;/p&gt;
&lt;p&gt;In the script for the cube, we have the following code for movement:&lt;/p&gt;</description></item><item><title>Arcade-style Spaceship</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/spaceship/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/spaceship/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to make a 3D spaceship that flies in an arcade/cinematic way. You&amp;rsquo;re not looking for realistic physics, but more of a dog-fighting, &amp;ldquo;Star Wars&amp;rdquo;-style of spaceflight.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;To accomplish this, we&amp;rsquo;ll use a &lt;i class="gd-CharacterBody3D"&gt;&lt;/i&gt; &lt;code&gt;CharacterBody3D&lt;/code&gt; for the ship. The three axis inputs (&lt;em&gt;pitch&lt;/em&gt;, &lt;em&gt;roll&lt;/em&gt;, and &lt;em&gt;yaw&lt;/em&gt;) will rotate the body&amp;rsquo;s &lt;code&gt;basis&lt;/code&gt; around the corresponding axis. The direction of motion will always point forward.&lt;/p&gt;
&lt;div class="box notices cstyle note"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-exclamation-circle"&gt;&lt;/i&gt; Note&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;You can do this with &lt;i class="gd-RigidBody3D"&gt;&lt;/i&gt; &lt;code&gt;RigidBody3D&lt;/code&gt; and get the same results. See the example project linked below, which includes a rigid body version as well.&lt;/p&gt;</description></item><item><title>Drawing Vectors in 3D</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/debug_overlay/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/debug_overlay/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;d like visual debug information in your 3D game: a way to see vectors representing velocity, position, etc.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Debug drawing in 2D is quite convenient. &lt;i class="gd-CanvasItem2D"&gt;&lt;/i&gt;&lt;code&gt;CanvasItem&lt;/code&gt; provides a range of primitive drawing methods to use in the &lt;code&gt;_draw()&lt;/code&gt; callback. In 3D, things are not quite so simple. One solution is to use &lt;code&gt;ImmediateGeometry&lt;/code&gt; to manually create meshes, but this is very cumbersome and inconvenient for quick debugging.&lt;/p&gt;</description></item><item><title>Arcade-style Airplane</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/simple_airplane/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/simple_airplane/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to make an airplane controller in 3D, but don&amp;rsquo;t need a fully accurate flight-simulator.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;In this recipe, we&amp;rsquo;re going to make a &lt;em&gt;simplified&lt;/em&gt; airplane controller. By &amp;ldquo;simplified&amp;rdquo; we mean stripping things down to the basics. We&amp;rsquo;re looking for the &amp;ldquo;feel&amp;rdquo; of flying a plane - one that you can just jump in and start flying effortlessly, with a minimal control scheme.&lt;/p&gt;
&lt;div class="box notices cstyle note"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-exclamation-circle"&gt;&lt;/i&gt; Note&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This recipe is &lt;em&gt;not&lt;/em&gt; an accurate flight simulator. We are not simulating aerodynamics, so this doesn&amp;rsquo;t fly like a &lt;em&gt;real&lt;/em&gt; airplane. We&amp;rsquo;re going for simplicity and &amp;ldquo;fun&amp;rdquo; here, not accuracy.&lt;/p&gt;</description></item><item><title>Arcade-style Car</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/3d_sphere_car/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/3d_sphere_car/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to make an arcade-style car game, so you&amp;rsquo;re looking for simplicity over realistic physics. In this recipe, you&amp;rsquo;ll learn how to make a fun, driveable car using a rolling sphere.&lt;/p&gt;
&lt;p&gt;&lt;video width="500" controls src="https://kamera25.github.io/godot_recipes/4.x/img/3d_sphere_car_01.webm"&gt;&lt;/video&gt;&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;There are a lot of ways to make a driving game. Different games need different levels of realism. If you&amp;rsquo;re trying to make a light, arcade-style car, you don&amp;rsquo;t need all of the features that Godot&amp;rsquo;s &lt;i class="gd-VehicleBody3D"&gt;&lt;/i&gt;&lt;code&gt;VehicleBody3D&lt;/code&gt; node provides, such as supension, independently modeled wheels, etc.&lt;/p&gt;</description></item><item><title>Click to move</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/click_to_move/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/click_to_move/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to move a 3D object to a clicked position.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll start with a flat plane for our world. Our actor will move on this plane.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-d3515d34c505be040df0fc6abd554681" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_click_01.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-d3515d34c505be040df0fc6abd554681"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_click_01.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The actor for this demo is a triangular prism mesh:&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-b147b5a905caa4edaee8cec17c4d3f97" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_click_02.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-b147b5a905caa4edaee8cec17c4d3f97"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/3d_click_02.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is the code for the movement. If given a target, the object will turn and move toward it.&lt;/p&gt;</description></item><item><title>Smooth rotation</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/rotate_interpolate/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/rotate_interpolate/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to smoothly rotate a 3D object to point in a new direction.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;When you first encounter this problem, you may find yourself thinking in terms of &lt;em&gt;Euler angles&lt;/em&gt; - the three values representing the angles to the &lt;strong&gt;x/y/z&lt;/strong&gt; axes. While Godot will allow you to see the object&amp;rsquo;s Euler angles in the &lt;code&gt;rotation&lt;/code&gt; property, it is not recommended to use them to work in 3D. There are a number of reasons why this the case, such as a problem called &amp;ldquo;gimbal lock&amp;rdquo;, where you lose one degree of freedom when one of your rotations reaches 90 degrees.&lt;/p&gt;</description></item><item><title>CharacterBody3D: Align with Surface</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/3d_align_surface/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/3d_align_surface/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You need your character body to align with the surface or terrain.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;This recipe builds on the basic &lt;i class="gd-CharacterBody3D"&gt;&lt;/i&gt;&lt;code&gt;CharacterBody3D&lt;/code&gt; controller described in the &lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/characterbody3d_examples/"&gt;CharacterBody3D: Movement&lt;/a&gt; recipe, so read that one first.&lt;/p&gt;
&lt;p&gt;First, we&amp;rsquo;ve added some terrain to the scene. You can download the terrain from here: &lt;a href="https://fertile-soil-productions.itch.io/modular-terrain-pack" target="_blank"&gt;https://fertile-soil-productions.itch.io/modular-terrain-pack&lt;/a&gt;. This is low-poly terrain, but you can use or make any terrain you like for this technique.&lt;/p&gt;
&lt;p&gt;As you can see, the movement still works with the terrain, but the tank seems to &amp;ldquo;float&amp;rdquo; above the slopes because it doesn&amp;rsquo;t change its orientation.&lt;/p&gt;</description></item><item><title>3D Kinematic Car</title><link>https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/index.html</link><pubDate>Wed, 09 Dec 2020 20:23:50 -0700</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/index.html</guid><description>&lt;h1 id="nbsp-3d-car"&gt;&lt;i class='fas fa-car'&gt;&lt;/i&gt; &amp;amp;nbsp 3D Car&lt;/h1&gt;
&lt;p&gt;Making a 3D car using &lt;code&gt;CharacterBody3D&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id="in-this-section"&gt;In this section:&lt;/h4&gt;
&lt;ul class="children children-li children-sort-weight"&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/car_base/index.html"&gt;3D Kinematic Car: Base&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/car_traction/index.html"&gt;3D Kinematic Car: Traction/Drifting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/car_camera/index.html"&gt;3D Kinematic Car: Chase Camera&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kamera25.github.io/godot_recipes/4.x/3d/kinematic_car/car_slopes/index.html"&gt;3D Kinematic Car: Slopes &amp;amp; Ramps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>