<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://www.vaclavelias.com">
  <title>Code or not to code</title>
  <subtitle>Blog about coding in .NET and C#.</subtitle>
  <link href="https://www.vaclavelias.com/feed.xml" rel="self"/>
  <link href="https://www.vaclavelias.com"/>
  <updated>2025-04-13T00:00:00Z</updated>
  <id>https://www.vaclavelias.com</id>
  <author>
    <name>Vaclav Elias</name>
  </author>
  <entry>
    <title>Stride Community Toolkit Preview - Code-Only Feature Basics in C# - Bepu Physics</title>
    <link href="https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/"/>
    <updated>2025-04-13T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/</id>
    <content xml:lang="en" type="html">&lt;p&gt;Discover the Stride Community Toolkit, a powerful collection of extensions and helpers designed for the Stride game engine. In this blog post (Bepu Physics version), we dive into the toolkit&#39;s &lt;strong&gt;code-only&lt;/strong&gt; feature, empowering C# and .NET developers to create immersive 2D/3D games and visualizations with ease. Explore how this community-driven, open-source project can simplify your game development journey.&lt;/p&gt;
&lt;p&gt;This blog post is part 1 of a 3-part series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/&quot;&gt;Stride Community Toolkit Preview - Code-Only Feature - Basics (C#)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp&quot;&gt;Bullet Physics version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Also available: &lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp&quot;&gt;Condensed F# version of this tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/examples/capsule-with-rigid-body-vb.html&quot;&gt;Visual Basic version is also possible&lt;/a&gt; but I am running out of space here 😅&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Stride Community Toolkit Preview - Code-Only Feature - Advanced&lt;/li&gt;
&lt;li&gt;Stride Community Toolkit Preview - Code-Only Feature - Refactoring&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Table of Contents:&lt;/p&gt;
&lt;div class=&quot;table-of-contents&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#introduction-%F0%9F%8C%B1&quot;&gt;Introduction 🌱&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#what-you&#39;ll-learn-%F0%9F%8E%AF&quot;&gt;What You&#39;ll Learn 🎯&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#basic-terminology-%F0%9F%93%9A&quot;&gt;Basic Terminology 📚&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#prerequisites-%F0%9F%8F%A0&quot;&gt;Prerequisites 🏠&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#how-to-use-the-code-snippets-%F0%9F%93%9D&quot;&gt;How to use the code snippets 📝&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#code-only-on-windows-%F0%9F%AA%9F&quot;&gt;Code-Only on Windows 🪟&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#code-only-on-other-platforms-%F0%9F%90%A7&quot;&gt;Code-Only on Other Platforms 🐧&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#the-story-of-the-brave-explorers-%F0%9F%93%98&quot;&gt;The Story of the Brave Explorers 📘&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot;&gt;Step 1: Create a New C# .NET 10 Console App - Nothingness ⚫&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot;&gt;Step 2: Let There Be Light - Or at Least Blue 🌌&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot;&gt;Step 3: Add Some Shapes - Capsule Time! 🎨&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;Step 4: Control the Camera - Look Around! 🖱️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot;&gt;Step 5: Reposition the Capsule - More Excitement! 📍&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot;&gt;Step 6: Add a Ground - Catch the Capsule! 🛑&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot;&gt;Step 7: Illuminate the Scene - Add Light! 💡&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;Step 8: Break 1 - Let&#39;s Reflect 😅&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot;&gt;Step 9: Add Profiler - Performance! 📈&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot;&gt;Step 10: Illuminate the Scene - Add Skybox! 🌇&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot;&gt;Step 11: Add Motion - I like to Move It, Move It! 🕺&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-entities-by-changing-their-position-directly-(without-colliders)&quot;&gt;Moving Entities by Changing Their Position Directly (Without Colliders)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-entities-using-physics-(with-colliders)&quot;&gt;Moving Entities Using Physics (With Colliders)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot;&gt;Step 12: Add Motion without Physics - Move the Cube without Colliders 📦&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot;&gt;Step 13: Add Motion with Physics - Move the Cube with Colliders! 🧊&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot;&gt;Step 14: Add Keyboard Interaction - Move the Cube! ⌨️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;Step 15: Add Mouse Interaction - Do something! 🖱️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot;&gt;Step 16: Add Output - Console or Screen! 📺&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#output-options&quot;&gt;Output Options&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#updating-the-console-output&quot;&gt;Updating the Console Output&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-output-to-the-screen&quot;&gt;Moving Output to the Screen&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#adding-ui-elements&quot;&gt;Adding UI Elements&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;Step 17: Break 2 - Let&#39;s Reflect 😅&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot;&gt;Step 18: Add More Primitives - Let&#39;s go crazy! 🤪&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot;&gt;Wrapping Up: Your Journey Continues 🎯&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#what-you&#39;ve-achieved&quot;&gt;What You&#39;ve Achieved&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#the-power-of-interactivity&quot;&gt;The Power of Interactivity&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#follow-up-articles-%F0%9F%9A%B6&quot;&gt;Follow-Up Articles 🚶&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;Support Stride Engine 🌟&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;h2 id=&quot;introduction-%F0%9F%8C%B1&quot; tabindex=&quot;-1&quot;&gt;Introduction 🌱 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#introduction-%F0%9F%8C%B1&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Welcome to the preview of the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/index.html&quot;&gt;Stride Community Toolkit&lt;/a&gt;, a collection of extensions and helpers for the &lt;a href=&quot;https://www.stride3d.net/&quot;&gt;Stride&lt;/a&gt; C# game engine. This community-driven, &lt;a href=&quot;https://github.com/stride3d/stride-community-toolkit&quot;&gt;open-source project&lt;/a&gt; is designed to assist developers in creating 2D/3D games and visualizations using &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/index.html&quot;&gt;Stride&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Although the toolkit is still in its early stages, it already offers several valuable features. In this post, I will focus on the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;code-only&lt;/a&gt; approach, which I found particularly useful for development.&lt;/p&gt;
&lt;p&gt;This article assumes that you have some experience with .NET and C# programming.&lt;/p&gt;
&lt;p&gt;The toolkit allows you to create a game using a code-only approach, meaning you can develop a game without relying on the Stride &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/index.html&quot;&gt;Game Studio&lt;/a&gt;. As a C#/.NET developer in my day job, I found this approach very helpful for getting started with the &lt;a href=&quot;https://github.com/stride3d/stride&quot;&gt;Stride engine&lt;/a&gt; and game development, bypassing the need to work directly in the Game Studio.&lt;/p&gt;
&lt;p&gt;You can also access the &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasics/Program.cs&quot;&gt;full source code for this post on GitHub&lt;/a&gt; to follow along or explore the final implementation directly.&lt;/p&gt;
&lt;p&gt;Additional details on the benefits of the code-only approach can be found &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;here&lt;/a&gt; in the toolkit documentation.&lt;/p&gt;
&lt;p&gt;We will be using a standard &lt;a href=&quot;https://learn.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio&quot;&gt;.NET 10 Console App&lt;/a&gt; to create a simple game by adding some NuGet packages to get started.&lt;/p&gt;
&lt;p&gt;Here’s the process I found to be the easiest way to begin with the code-only approach:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run the minimal code to get the game window running&lt;/li&gt;
&lt;li&gt;Add entities/primitives to the scene&lt;/li&gt;
&lt;li&gt;Add interaction with the keyboard and mouse&lt;/li&gt;
&lt;li&gt;Add output to the console or screen&lt;/li&gt;
&lt;li&gt;Play around, be creative and have fun&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This post was updated to use the latest version of the Stride Community Toolkit, which now includes the &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Bepu physics engine&lt;/a&gt; as the default physics engine. The previous version used Bullet Physics, which is still available but not recommended for new projects. The Bepu physics engine is a powerful and efficient physics engine that provides advanced simulation capabilities for 3D games and visualizations. Thank you &lt;a href=&quot;https://github.com/dboggs95&quot;&gt;Daryl&lt;/a&gt; for your help with this update! 🙏&lt;/p&gt;
&lt;h2 id=&quot;what-you&#39;ll-learn-%F0%9F%8E%AF&quot; tabindex=&quot;-1&quot;&gt;What You&#39;ll Learn 🎯 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#what-you&#39;ll-learn-%F0%9F%8E%AF&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By the end of this post, you will have a solid foundation in using the Stride Community Toolkit&#39;s code-only feature to create a simple game. You’ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up the game window and initialize the core components&lt;/li&gt;
&lt;li&gt;Add and manipulate entities within the scene&lt;/li&gt;
&lt;li&gt;Implement basic interactivity using the keyboard and mouse&lt;/li&gt;
&lt;li&gt;Display text output to the console or directly on the screen for debugging or player feedback&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Coding enhances creativity and problem-solving, and we can take that creativity to the next level through visualization, whether it&#39;s in games, simulations, or simply experimenting with 3D models in a virtual space.&lt;/p&gt;
&lt;p&gt;Whether you’re a seasoned developer or new to game development, this post will guide you through the essential steps to get your first game up and running with Stride. Ready to dive in? Let’s get started! 🚀&lt;/p&gt;
&lt;h2 id=&quot;basic-terminology-%F0%9F%93%9A&quot; tabindex=&quot;-1&quot;&gt;Basic Terminology 📚 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#basic-terminology-%F0%9F%93%9A&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving into the steps, it&#39;s helpful to understand some key terms that will be used throughout this guide:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.stride3d.net/&quot;&gt;Stride&lt;/a&gt;: A C# game engine for creating 2D/3D games and visualizations.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/index.html&quot;&gt;Stride Community Toolkit&lt;/a&gt;: A collection of extensions and helpers for the Stride engine.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Bepu Physics&lt;/a&gt;: The preferred physics engine for Stride, providing advanced &lt;a href=&quot;https://github.com/bepu/bepuphysics2&quot;&gt;Bepu physics&lt;/a&gt; simulation capabilities.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;Code-Only&lt;/a&gt;: A feature of the toolkit that allows you to create a game without using the Game Studio.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.Game.html&quot;&gt;Game&lt;/a&gt;: In the context of this post, a game refers to any interactive or visual project created using a game engine. This can range from traditional playable games to simulations, visualizations, or any real-time interactive experiences where users can interact with or observe elements within a scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/scenes.html&quot;&gt;Scene&lt;/a&gt;: The container for entities, which defines the game world or environment.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.Entity.html&quot;&gt;Entity&lt;/a&gt;: An object in the scene that can represent anything from a 3D model to a camera or light and aggregates multiple EntityComponents.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.EntityComponent.html&quot;&gt;EntityComponent&lt;/a&gt;: A base component that defines the behavior or properties of an entity. Other components inherit from this class.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.BepuPhysics.BodyComponent.html&quot;&gt;BodyComponent&lt;/a&gt;: A physics component that allows an entity to respond to forces like gravity and collisions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;Graphics Compositor&lt;/a&gt;: A component that organizes how scenes are rendered in the Stride engine.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/cameras/index.html&quot;&gt;Camera&lt;/a&gt;: A camera that allows viewing the scene from different angles.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpintermediate/third-person-camera.html&quot;&gt;Camera Controller&lt;/a&gt;: A script that enables basic camera movement using keyboard and mouse inputs.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Graphics.GeometricPrimitives.GeometricPrimitive.Cube.html&quot;&gt;3D Primitive&lt;/a&gt;: A basic 3D model, such as a capsule, cube, or sphere.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/colliders.html&quot;&gt;Collidable&lt;/a&gt;: A component that defines the shape of an entity for physical interactions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Physics Engine&lt;/a&gt;: A system that simulates physical interactions between entities in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/troubleshooting/profiling.html&quot;&gt;Profiler&lt;/a&gt;: A tool that monitors performance metrics like frames per second (FPS) and memory usage.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;Skybox&lt;/a&gt;: A textured 3D model that provides a background for the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Video_game_programming#Game_structure&quot;&gt;Game Loop&lt;/a&gt;: The main loop that drives the game, updating the state and rendering the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/scripts/types-of-script.html#synchronous-scripts&quot;&gt;Update Method&lt;/a&gt;: A callback method that is called every frame to update the game state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Based Movement:&lt;/strong&gt; Moving entities using the physics engine to simulate realistic interactions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical Movement:&lt;/strong&gt; Moving entities by directly changing their position without physics interactions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpbeginner/transform-position.html&quot;&gt;Transform&lt;/a&gt;: Defines an entity&#39;s position, rotation, and scale in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.BepuPhysics.BodyComponent.html#Stride_BepuPhysics_BodyComponent_ApplyImpulse_Stride_Core_Mathematics_Vector3_Stride_Core_Mathematics_Vector3_&quot;&gt;Impulse&lt;/a&gt;: A vector that represents a physical impulse applied to an &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/rigid-bodies.html&quot;&gt;entity&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpbeginner/delta-time.html&quot;&gt;Delta Time&lt;/a&gt;: The time elapsed between frames, used for frame-independent movement.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/materials/index.html&quot;&gt;Material&lt;/a&gt;: A visual property that defines how an entity is rendered, including color, texture, and shading.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/api/Stride.CommunityToolkit.Engine.GameExtensions.html#Stride_CommunityToolkit_Engine_GameExtensions_AddGroundGizmo_Stride_Engine_Game_System_Nullable_Stride_Core_Mathematics_Vector3__System_Boolean_System_Boolean_&quot;&gt;Ground Gizmo&lt;/a&gt;: A visual representation of the ground plane and axis directions in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Games.GameTime.html&quot;&gt;GameTime&lt;/a&gt;: A structure that provides time-related information for the game loop.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Core.Mathematics.Vector3.html&quot;&gt;Vector3&lt;/a&gt;: A 3D vector that represents a point or direction in 3D space.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Frame_rate&quot;&gt;Frame Rate&lt;/a&gt;: The number of frames rendered per second, measured in frames per second (FPS).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;prerequisites-%F0%9F%8F%A0&quot; tabindex=&quot;-1&quot;&gt;Prerequisites 🏠 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#prerequisites-%F0%9F%8F%A0&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These prerequisites were tested on a clean Windows 11 installation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://aka.ms/vc14/vc_redist.x64.exe&quot;&gt;Microsoft Visual C++ v14 Redistributable (x64)&lt;/a&gt; (approximately 19MB) and restart your system if prompted.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://dotnet.microsoft.com/en-us/download&quot;&gt;.NET 10 SDK x64&lt;/a&gt; (around 215MB).&lt;/li&gt;
&lt;li&gt;Install the IDE of your choice. I will be using &lt;a href=&quot;https://visualstudio.microsoft.com/downloads/&quot;&gt;Visual Studio 2026&lt;/a&gt; (the Community version is free), but you can also use:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;Visual Studio Code&lt;/a&gt; - Free&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.jetbrains.com/rider/download/#section=windows&quot;&gt;Rider&lt;/a&gt; - Free for non-commercial use&lt;/li&gt;
&lt;li&gt;Any other IDE that supports .NET development&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;how-to-use-the-code-snippets-%F0%9F%93%9D&quot; tabindex=&quot;-1&quot;&gt;How to use the code snippets 📝 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#how-to-use-the-code-snippets-%F0%9F%93%9D&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can copy and paste the code into your &lt;code&gt;Program.cs&lt;/code&gt; file and run the application to see the results.&lt;/p&gt;
&lt;p&gt;You will be guided to replace some parts of the code with the new code snippets as you progress through the steps or replacing the entire &lt;code&gt;Program.cs&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Also, the code snippets contain comments which part of the code is new or updated.&lt;/p&gt;
&lt;h2 id=&quot;code-only-on-windows-%F0%9F%AA%9F&quot; tabindex=&quot;-1&quot;&gt;Code-Only on Windows 🪟 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#code-only-on-windows-%F0%9F%AA%9F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The code-only approach is currently available only on Windows. The toolkit provides a set of NuGet packages that you can use to create a game without the need for the Game Studio.&lt;/p&gt;
&lt;h2 id=&quot;code-only-on-other-platforms-%F0%9F%90%A7&quot; tabindex=&quot;-1&quot;&gt;Code-Only on Other Platforms 🐧 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#code-only-on-other-platforms-%F0%9F%90%A7&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Code-only development isn&#39;t fully supported on non-Windows platforms yet, but progress is being made. Thanks to &lt;a href=&quot;https://github.com/stride3d/stride/pull/2279&quot;&gt;this PR&lt;/a&gt;, the build tool &lt;code&gt;Stride.Core.Assets.CompilerApp&lt;/code&gt;, which is responsible for building assets, now works on Linux as a cross-platform binary.&lt;/p&gt;
&lt;p&gt;However, there are still some limitations. A known workaround for Linux (Ubuntu) is documented here: &lt;a href=&quot;https://github.com/stride3d/stride/issues/2596&quot;&gt;Code-Only Development on Linux (Ubuntu) Requires Manual File Copying&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While Stride is a cross-platform engine and you can build your game on Windows and run it elsewhere, full support for code-only workflows on platforms like Linux is still evolving.&lt;/p&gt;
&lt;h2 id=&quot;the-story-of-the-brave-explorers-%F0%9F%93%98&quot; tabindex=&quot;-1&quot;&gt;The Story of the Brave Explorers 📘 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#the-story-of-the-brave-explorers-%F0%9F%93%98&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;🌍 Welcome, brave explorers of the digital wilderness! Today, we embark on an exciting journey into the heart of the Stride game engine. Our guide? None other than the Stride Community Toolkit.&lt;/p&gt;
&lt;p&gt;In the vast expanse of the coding universe, we&#39;ll create a new world from nothing but a .NET 10 Console App. Prepare to witness the birth of a game window, a black void of nothingness that will soon teem with life 🫎.&lt;/p&gt;
&lt;p&gt;As we venture further, we&#39;ll bring light into our world, transforming the empty void into a vibrant blue expanse. But what&#39;s a world without inhabitants? We&#39;ll conjure a 3D capsule, our first digital lifeform, into existence.&lt;/p&gt;
&lt;p&gt;Beware, fellow adventurers! Our capsule is a wild creature, prone to falling into the void. But fear not, for we&#39;ll harness the power of a 3D camera 🎥 controller to keep a watchful eye 👁️ on our creation.&lt;/p&gt;
&lt;p&gt;As we continue, we&#39;ll introduce motion, allowing our entities to interact with their surroundings and respond to player input. From keyboard controls to mouse interactions, our world will come to life with movement and action. 🕹️&lt;/p&gt;
&lt;p&gt;Finally, we’ll display messages and feedback with both console output and on-screen text, letting our creation communicate with us through the game window. 📝&lt;/p&gt;
&lt;p&gt;So, refresh your mouse agility skills 🖱️, and join us on this exhilarating expedition. Let&#39;s dive into the code! 💻&lt;/p&gt;
&lt;h2 id=&quot;step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot; tabindex=&quot;-1&quot;&gt;Step 1: Create a New C# .NET 10 Console App - Nothingness ⚫ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a new C# .NET 10 Console App in your IDE or use the command line:&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet new console &lt;span class=&quot;token parameter variable&quot;&gt;--framework&lt;/span&gt; net10.0 &lt;span class=&quot;token parameter variable&quot;&gt;--name&lt;/span&gt; YourProjectName&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add the following NuGet package: 📦&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Windows &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Paste the following code into your &lt;code&gt;Program.cs&lt;/code&gt; file: 💻&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Build the project from the command line or use your IDE to build it:&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet build&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the application.&lt;/li&gt;
&lt;li&gt;Behold the black void of nothingness 🙀.&lt;/li&gt;
&lt;/ol&gt;
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; style=&quot;display: none;&quot;&gt;
    &lt;symbol id=&quot;success&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;info&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;light&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;warning&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;danger&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
&lt;/svg&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;If you&#39;re still on Stride 4.2, use &lt;code&gt;--version 1.0.0-preview.61&lt;/code&gt; instead of &lt;code&gt;--prerelease&lt;/code&gt;, which targets Stride 4.3. This applies to all NuGet packages mentioned below.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;The NuGet package &lt;code&gt;Stride.CommunityToolkit.Windows&lt;/code&gt; is used specifically for code-only projects. You should use the &lt;code&gt;Stride.CommunityToolkit&lt;/code&gt; NuGet package when referencing from a regular Stride project generated from the Game Studio.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to set up a Stride game window using the Stride Community Toolkit. Even though it&#39;s just a black screen, the game window is running, marking the first step in your journey.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot; tabindex=&quot;-1&quot;&gt;Step 2: Let There Be Light - Or at Least Blue 🌌 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once upon a time in a galaxy far, far away, you should see a window with a black background. This is the Stride game window. 🖥️ As a black screen is not very exciting, let&#39;s add some mystery code to make it more interesting. This time, we use the &lt;code&gt;Stride.CommunityToolkit.Engine&lt;/code&gt; namespace so we can reference some of the toolkit helper methods. 🔧✨&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Import the toolkit&#39;s helper methods&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The code above does the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Start()&lt;/code&gt; method is a callback that is invoked when the game starts. It takes a &lt;code&gt;Scene&lt;/code&gt; object as a parameter, representing the root scene of the game.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddGraphicsCompositor()&lt;/code&gt; organizes &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;how scenes are rendered&lt;/a&gt; in the Stride engine, enabling extensive customization of the rendering pipeline.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Add3DCamera()&lt;/code&gt; adds a 3D camera to the scene, allowing you to view it from various angles.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. Now, instead of a black screen, you should see a blue screen. 🌌 While not overly exciting, it’s a step in the right direction. We’re looking through the camera, but there’s nothing to see yet. 👀&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned that Graphics Compositor is used to handle rendering and 3D Camera is used to view the scene from different angles. There&#39;s still nothing to see yet because we haven’t added any objects to the scene. 🤷‍♂️&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot; tabindex=&quot;-1&quot;&gt;Step 3: Add Some Shapes - Capsule Time! 🎨 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firstly, we need to add another NuGet package, &lt;code&gt;Stride.CommunityToolkit.Bepu&lt;/code&gt;, which includes the Bepu physics engine. This package is required for the physics engine to work properly. You can add it using the following command:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Bepu &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now let&#39;s add something to the scene. 🎨 This time, we will be utilizing the &lt;code&gt;Stride.CommunityToolkit.Rendering.ProceduralModels&lt;/code&gt; namespace, which provides helper methods for generating procedural models like capsules, cubes, and spheres. We will add a capsule to the scene.&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Import the Bepu physics engine&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import procedural model helpers&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this step, we added a new line that creates a 3D primitive capsule. 🧊 The &lt;code&gt;Create3DPrimitive()&lt;/code&gt; method takes a &lt;code&gt;PrimitiveModelType&lt;/code&gt; enum as a parameter and returns an &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/add-entities.html&quot;&gt;&lt;code&gt;Entity&lt;/code&gt;&lt;/a&gt; object, with a collider included by default. The &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/api/Stride.CommunityToolkit.Rendering.ProceduralModels.PrimitiveModelType.html&quot;&gt;&lt;code&gt;PrimitiveModelType&lt;/code&gt;&lt;/a&gt; enum defines the types of primitive 3D models that can be generated, such as capsules, cubes, and spheres.&lt;/p&gt;
&lt;p&gt;Run the application again. Surprise, nothing happened! 😲🤬 We created an entity, but we didn&#39;t add it to the scene. This is a typical beginner&#39;s mistake 🤦‍♂️. To fix it, update the &lt;code&gt;Start()&lt;/code&gt; method to look like this.&lt;/p&gt;
&lt;p&gt;You can replace the entire &lt;code&gt;Start()&lt;/code&gt; method with the code below:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, run the application again. You should see a capsule in the middle of the screen if you&#39;re lucky because it&#39;s falling down. Fast! 🚀&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Capsule in blue game window&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-3.webp&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-3.webp&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to create and add a 3D capsule to the scene using procedural models. By adding the entity to the root scene, it becomes part of the scene graph. The capsule is falling because it lacks a collider to interact with the ground, which we&#39;ll address later.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 4: Control the Camera - Look Around! 🖱️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Maybe we should at least look around the scene and view the capsule from different angles as it falls into the void 🤔?&lt;/p&gt;
&lt;p&gt;Let&#39;s add a 3D camera controller using the &lt;code&gt;Add3DCameraController()&lt;/code&gt; method. 🎮 This extension adds basic camera functionality, allowing you to interact with the camera through keyboard and mouse inputs. Specifically, it attaches a regular &lt;code&gt;SyncScript&lt;/code&gt; to the camera with custom logic to handle camera movement.&lt;/p&gt;
&lt;p&gt;In most games, you would implement your own custom camera logic to fit the specific needs of your game. However, for this example, we&#39;ll use the default camera controller to get basic camera movement up and running quickly.&lt;/p&gt;
&lt;p&gt;Time to refresh those mouse agility skills!&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// This was updated: Add a camera controller for basic camera movement&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again and use right-click and hold to rotate the camera towards the capsule, or follow the instructions displayed on the screen. 🎥 Feeling a bit more satisfied now? Let’s make the experience even more interesting! 🎨✨&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Game controller instructions&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-4.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-4.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a 3D camera controller to the scene, enabling basic camera movement. Now, you can rotate the camera using the mouse and keyboard, giving you more control over how you view the scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot; tabindex=&quot;-1&quot;&gt;Step 5: Reposition the Capsule - More Excitement! 📍 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s reposition the capsule to add a bit more excitement and give us a few extra seconds to admire it before it falls. Update the &lt;code&gt;Start()&lt;/code&gt; method as shown below, and don&#39;t forget to add the &lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; namespace for handling the 3D positioning.&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Make sure that &lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; is used instead of &lt;code&gt;System.Numerics&lt;/code&gt; which also contains &lt;code&gt;Vector3&lt;/code&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import Vector3 and other math utilities&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;entity.Transform.Position&lt;/code&gt; sets the position of the entity within the scene. The &lt;code&gt;Vector3&lt;/code&gt; object represents a 3D vector, which in this case, places the capsule at coordinates &lt;code&gt;(0, 8, 0)&lt;/code&gt;, which is 8 units above the scene&#39;s origin.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; Stride uses its own implementation of &lt;code&gt;Vector3&lt;/code&gt; and other math utilities, so we need to add this namespace to access those features.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. You should see a capsule falling down from the top of the screen. I know, the capsule is black, but don&#39;t worry, we&#39;ll fix that later. 😉&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Reposition Capsule&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-5.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-5.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to reposition the capsule in the scene using the &lt;code&gt;Transform&lt;/code&gt; component&#39;s &lt;code&gt;Position&lt;/code&gt; property. The capsule is now positioned 8 units above the origin, giving you more time to admire it as it falls into the void.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot; tabindex=&quot;-1&quot;&gt;Step 6: Add a Ground - Catch the Capsule! 🛑 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now let&#39;s catch the capsule by adding some ground to the scene. Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this so we can feel more grounded.&lt;/p&gt;
&lt;p&gt;You can replace the entire &lt;code&gt;Start()&lt;/code&gt; method with the code below:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Add3DGround()&lt;/code&gt; is a toolkit helper method that creates a 3D ground plane in the scene, providing a surface for the capsule to land on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. You should see the capsule falling down and landing on the ground. 🎉 Unfortunately, it&#39;s still a black capsule on a black ground 🤦‍♂️. But don&#39;t worry, we’ll fix that later! In the meantime, you can move the camera around using the mouse and keyboard (Q or E) to lower or raise the camera and watch the capsule roll around on the ground. 🖱️⌨️&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;If you&#39;re wondering why the ground is invisible from below, it&#39;s due to back face culling. This technique prevents the engine from drawing polygons that face away from the camera, improving performance by avoiding unnecessary rendering. The same applies to the cube and other primitives: if the camera is inside the object, the walls won&#39;t be visible.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;row mb-2&quot;&gt;
    &lt;div class=&quot;col-6&quot;&gt;
    &lt;a href=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6a.jpg&quot; title=&quot;Stride Game Engine - Code Only Basic - Ground added&quot; class=&quot;mb-2&quot;&gt;&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Ground added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6a.jpg&quot; class=&quot;img-fluid&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-6a.jpg&quot; /&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;col-6&quot;&gt;
    &lt;a href=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6b.jpg&quot; title=&quot;Stride Game Engine - Code Only Basic - Ground, different angle&quot; class=&quot;mb-2&quot;&gt;&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Ground, different angle&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6b.jpg&quot; class=&quot;img-fluid&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-6b.jpg&quot; /&gt;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a 3D ground plane to the scene, giving the capsule a surface to land on. Now, the capsule falls and lands on the ground, making the scene feel more dynamic.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot; tabindex=&quot;-1&quot;&gt;Step 7: Illuminate the Scene - Add Light! 💡 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It&#39;s time to brighten things up! Adding some light to the scene will help us see our objects more clearly. Thankfully, there&#39;s a helper method called &lt;code&gt;AddDirectionalLight()&lt;/code&gt; that adds a directional light to the scene. Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. 🌟 You should now see the capsule falling down and landing on the ground, with everything clearly illuminated by the directional light. The capsule and ground are much easier to see, thanks to the added light shining on the scene. 🎉&lt;/p&gt;
&lt;p&gt;Finally, no more black-on-black mysteries! 💡&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Light added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-7.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-7.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a directional light to the scene, illuminating both the capsule and the ground. The scene is now well-lit, making it much easier to see and interact with the objects.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot; tabindex=&quot;-1&quot;&gt;Step 8: Break 1 - Let&#39;s Reflect 😅 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Tedious work, but you just learned the very basics of game setup behind the scenes, which is usually done in the Game Studio for you automatically.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;Graphics Compositor&lt;/a&gt; to render the scene&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/cameras/index.html&quot;&gt;Camera&lt;/a&gt; to view the scene&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpintermediate/third-person-camera.html&quot;&gt;Camera Controller&lt;/a&gt; to move the camera around. This is a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/scripts/index.html&quot;&gt;C# script&lt;/a&gt; that controls the camera&#39;s position and orientation&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/lights-and-shadows/index.html&quot;&gt;Light&lt;/a&gt; to illuminate the scene&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once the basics are set up, you need to add entities to the scene. In our example, we added:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A 3D Ground, a simple primitive model that provides a surface.&lt;/li&gt;
&lt;li&gt;A Capsule, another primitive model, which we’ve repositioned and dropped into the scene.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The toolkit added &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/colliders.html&quot;&gt;collidables&lt;/a&gt; for the ground and capsule, ensuring that the capsule doesn&#39;t fall through the ground but instead interacts realistically with the scene.&lt;/p&gt;&lt;div class=&quot;alert alert-info d-flex&quot;&gt;&lt;br /&gt;
&lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;br /&gt;
&lt;div&gt;You can review the implementation of each &lt;a href=&quot;https://github.com/stride3d/stride-community-toolkit/tree/main/src/Stride.CommunityToolkit&quot;&gt;Stride toolkit extension&lt;/a&gt;, which wraps some boilerplate code, and create your own custom implementation.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Whew! 😅 Take a deep breath, and get ready for the next part of our journey. Up next: performance optimizations and more interactive elements. 🚀&lt;/p&gt;
&lt;h2 id=&quot;step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot; tabindex=&quot;-1&quot;&gt;Step 9: Add Profiler - Performance! 📈 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As game developers, we love seeing those sweet FPS numbers! 🎮 The toolkit provides a &lt;code&gt;AddProfiler()&lt;/code&gt; method that adds a performance profiler to the game, allowing us to monitor important metrics like frames per second (FPS).&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. You should see &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/troubleshooting/profiling.html&quot;&gt;profiler text output&lt;/a&gt; in the top-left corner of the screen, showing the frames per second (FPS) and other performance metrics. 🚀 Press F1 to cycle through different profiler outputs and monitor various aspects of your game&#39;s performance. 📊&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Profiler added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-9.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-9.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a performance profiler to the scene, enabling you to monitor FPS and other important metrics. The profiler provides valuable insights into your game&#39;s performance, helping you identify areas for optimization.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot; tabindex=&quot;-1&quot;&gt;Step 10: Illuminate the Scene - Add Skybox! 🌇 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As exciting as things are looking, we can make our scene even better by adding a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;skybox&lt;/a&gt;. A skybox will enhance the overall atmosphere and give our scene a more polished, realistic look. 🌇&lt;/p&gt;
&lt;p&gt;The toolkit provides a &lt;code&gt;AddSkybox()&lt;/code&gt; method that adds a skybox to the scene. First, we need to add another NuGet package, &lt;code&gt;Stride.CommunityToolkit.Skyboxes&lt;/code&gt;, which includes assets required for the skybox.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Skyboxes &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, update the code to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import skybox helpers&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. 🎮 You should now see a beautiful skybox surrounding the scene, making it look more immersive and realistic. 🌅 The &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;skybox&lt;/a&gt; is essentially a large, textured 3D model that wraps around the entire scene, providing a visually appealing background. 🌇&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Skybox added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-10.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-10.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a skybox to the scene, enhancing the visuals and creating a more immersive environment. The skybox provides a realistic backdrop, adding depth and atmosphere to your scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot; tabindex=&quot;-1&quot;&gt;Step 11: Add Motion - I like to Move It, Move It! 🕺 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before we dive into coding, let&#39;s take a moment to explore the different ways we can move entities in our scene. In Stride, we can move objects using two main approaches: &lt;strong&gt;non-physical movement&lt;/strong&gt; and &lt;strong&gt;physics-based movement&lt;/strong&gt;. Each method has its strengths and use cases, depending on the type of game or simulation you&#39;re creating.&lt;/p&gt;
&lt;h3 id=&quot;moving-entities-by-changing-their-position-directly-(without-colliders)&quot; tabindex=&quot;-1&quot;&gt;Moving Entities by Changing Their Position Directly (Without Colliders) &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-entities-by-changing-their-position-directly-(without-colliders)&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This method involves directly modifying an entity&#39;s position in the scene by changing its &lt;code&gt;Transform.Position&lt;/code&gt;. It&#39;s a straightforward approach that allows you to move objects freely without considering the physics of the environment. Here are some key points to keep in mind:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simple Movement:&lt;/strong&gt; This method is ideal for scenarios where you want to move objects in a controlled manner without requiring interaction with other entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical:&lt;/strong&gt; The entity doesn&#39;t respond to gravity, collisions, or any external forces. This makes it perfect for UI elements, floating objects, or objects that need to follow a predefined path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No Interaction:&lt;/strong&gt; By default, the entity won&#39;t collide with or interact with other objects in the scene. This can simplify certain game mechanics but also limits realism.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use cases for non-physical movement include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Camera Movement:&lt;/strong&gt; Moving a camera smoothly around the scene without it being affected by the environment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI Elements:&lt;/strong&gt; Moving user interface elements, like menus or health bars, without considering collisions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cutscenes or Animations:&lt;/strong&gt; Predefined animations where objects follow scripted paths.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;
You can still add custom code or use Stride&#39;s &lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Core.Mathematics.CollisionHelper.html&quot;&gt;&lt;code&gt;CollisionHelper&lt;/code&gt;&lt;/a&gt; for basic interactions. For example, you can check for conditions like &lt;code&gt;BoxIntersectsBox&lt;/code&gt; or calculate distances between objects with &lt;code&gt;DistanceBoxBox&lt;/code&gt;.
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;moving-entities-using-physics-(with-colliders)&quot; tabindex=&quot;-1&quot;&gt;Moving Entities Using Physics (With Colliders) &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-entities-using-physics-(with-colliders)&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This approach leverages &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Stride&#39;s physics engine&lt;/a&gt; to handle movement. By applying forces and impulses to an entity&#39;s &lt;code&gt;BodyComponent&lt;/code&gt;, we can create realistic interactions that respond to gravity, collisions, and other physical phenomena. Key aspects of this approach include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Realistic Movement:&lt;/strong&gt; Entities move according to the laws of physics, making this method suitable for objects that need to interact with the environment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Collisions:&lt;/strong&gt; The entity will collide with other objects, allowing for dynamic interactions, such as objects bouncing off surfaces or pushing each other.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Forces:&lt;/strong&gt; Movement can be influenced by various forces, including gravity, wind, or explosions. This allows for more complex and dynamic gameplay mechanics.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Driven Gameplay:&lt;/strong&gt; This method is ideal for games that rely on physics-based mechanics, such as puzzle games, platformers, or simulations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use cases for physics-based movement include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Objects:&lt;/strong&gt; Moving objects that need to interact with other entities, like bouncing balls or rolling barrels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Character Movement:&lt;/strong&gt; Characters or vehicles that need to respond to the environment realistically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Environmental Interaction:&lt;/strong&gt; Objects that react to player actions, such as crates that can be pushed or destroyed.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned about the two main approaches to moving entities in Stride: non-physical movement and physics-based movement. Each method offers unique advantages, depending on whether you need simple control or realistic physics-driven interactions in your game or simulation.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot; tabindex=&quot;-1&quot;&gt;Step 12: Add Motion without Physics - Move the Cube without Colliders 📦 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s add a a cube 📦 to the scene! 🎉&lt;/p&gt;
&lt;p&gt;We&#39;ll start with the first option: moving the cube by directly changing its position. Update the code to look like this or replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for non-physical movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This is crucial for frame-independent movement, ensuring consistent&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// behaviour regardless of frame rate.&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;token comment&quot;&gt;// Move the cube along the negative X-axis with frame-independent motion&lt;/span&gt;
        cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;movementSpeed&lt;/code&gt; determines how fast the cube moves.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube1&lt;/code&gt; is an &lt;code&gt;Entity&lt;/code&gt; object representing the cube in the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Run(start: Start, update: Update)&lt;/code&gt; now includes the &lt;code&gt;Update&lt;/code&gt; method as a callback for updating the game state every frame.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddGroundGizmo()&lt;/code&gt; adds a visual representation of the ground plane and axis directions. Just a visual aid, it doesn&#39;t affect the physics of the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CreateMaterial()&lt;/code&gt; allows you to color the cube (and even the capsule if you want 😉).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Update()&lt;/code&gt; is a callback method that is called every frame to update the game state.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. 🏃 You should see a box (cube) moving along the X-axis, without interacting with other entities.&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-12.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-12.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to move a cube without using colliders, applying non-physical movement. The cube moves smoothly along the X-axis, showcasing basic object manipulation and animation.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot; tabindex=&quot;-1&quot;&gt;Step 13: Add Motion with Physics - Move the Cube with Colliders! 🧊 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now that we&#39;ve moved the cube without colliders, let&#39;s dive into the more realistic option: moving the cube using physics. With this approach, the cube will interact with the environment, responding to forces like gravity and colliding with other entities.&lt;/p&gt;
&lt;p&gt;Update the code to include physics-based movement or replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BepuPhysics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Create a second cube with a collider for physics-based interaction&lt;/span&gt;
    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// Reposition the cube above the ground&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis (non-physical movement)&lt;/span&gt;
        cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the BodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check if cube2 is stationary by verifying if its linear velocity is effectively zero.&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Math&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Round&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;LinearVelocity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to cube2 along the X-axis, initiating movement. Impulse offset is set to zero.&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// Reverse the direction of the impulse for the next impulse,&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// allowing cube2 to move back and forth along the X-axis.&lt;/span&gt;
            force &lt;span class=&quot;token operator&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Stride.BepuPhysics&lt;/code&gt; provides access to physics-related classes and components, including the &lt;code&gt;BodyComponent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;force&lt;/code&gt; determines the strength of the impulse applied to the cube.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube2&lt;/code&gt; is an &lt;code&gt;Entity&lt;/code&gt; object representing the cube that will move using physics-based interactions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BodyComponent&lt;/code&gt; handles physics interactions, allowing the entity to respond to forces, gravity, and collisions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;LinearVelocity&lt;/code&gt; represents the velocity of the cube. We check if the velocity is near zero (indicating the cube is stationary) before applying the impulse.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ApplyImpulse()&lt;/code&gt; applies a force to the entity, causing it to move in the direction of the applied force. In this case, we&#39;re applying an impulse to the cube, making it move along the X-axis.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. 🏃‍♂️ You should now see two cubes in the scene:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cube 1&lt;/strong&gt; moves along the X-axis using non-physical movement, just like in the previous step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cube 2&lt;/strong&gt; interacts with the environment using physics, responding to forces and collisions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This step introduces a new level of realism by making the cube react to physical forces, adding depth and complexity to your game. 🎮&lt;/p&gt;
&lt;p&gt;The main difference between the two cubes is that &lt;strong&gt;Cube 1&lt;/strong&gt; moves without interacting with the environment. We directly modify the entity&#39;s &lt;code&gt;Transform.Position&lt;/code&gt; to move it, resulting in simple, non-physical movement. In contrast, &lt;strong&gt;Cube 2&lt;/strong&gt; responds to physics, collisions, and forces. Instead of manually changing its position, we control its movement through the &lt;code&gt;BodyComponent&lt;/code&gt;, which handles all the physics-based interactions, including gravity, impulses, and collisions with other objects in the scene. This makes Cube 2&#39;s movement more realistic and reactive to its surroundings.&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-13.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-13.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to move a cube using physics-based movement, allowing it to interact with the environment. The cube responds to forces, gravity, and collisions, creating a more dynamic and realistic scene. You now understand the key differences between non-physical and physics-based movement, giving you greater control over how objects interact in your game world.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 14: Add Keyboard Interaction - Move the Cube! ⌨️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now it&#39;s time to add some interactivity! 🎮 We will update the &lt;code&gt;Update()&lt;/code&gt; method to allow the player to move the cubes around using the keyboard. We&#39;ll make sure both &lt;strong&gt;Cube 1&lt;/strong&gt; (non-physical movement) and &lt;strong&gt;Cube 2&lt;/strong&gt; (physics-based movement) respond to key presses.&lt;/p&gt;
&lt;p&gt;Ensure that the &lt;code&gt;using Stride.Input;&lt;/code&gt; namespace is included to handle input.&lt;/p&gt;
&lt;p&gt;You can replace the existing &lt;code&gt;Update&lt;/code&gt; method with the following code:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis when the Z key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the positive X-axis when the X key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the BodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// We use KeyPressed instead of KeyDown to apply impulses only once per key press.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// This means the player needs to press and release the key to apply an impulse,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// preventing multiple impulses from being applied while the key is held down.&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the left when the C key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Wake up the rigid body to ensure it can respond to impulses&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the right when the V key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Wake up the rigid body to ensure it can respond to impulses&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;game.Input.IsKeyDown()&lt;/code&gt; checks if a key is currently held down. This is useful for continuous actions, like moving an object as long as the key is pressed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Input.IsKeyPressed()&lt;/code&gt; checks if a key was pressed and released once. This is ideal for triggering actions that should only occur once per key press, such as applying an impulse to a physics object, to avoid multiple impulses being applied while the key is held down.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rigidBody.Awake = true;&lt;/code&gt; gets or sets whether the body is in the active set. Setting this to &lt;code&gt;true&lt;/code&gt; will attempt to wake the body; setting it to &lt;code&gt;false&lt;/code&gt; will force the body and any constraint-connected bodies asleep. Using an awake mechanism helps by reducing the computational overhead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Additional Points:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The non-physical movement for &lt;strong&gt;Cube 1&lt;/strong&gt; allows smooth, continuous movement along the X-axis when holding the Z or X keys.&lt;/li&gt;
&lt;li&gt;The physics-based movement for &lt;strong&gt;Cube 2&lt;/strong&gt; applies an impulse to the cube when the C or V keys are pressed, allowing it to interact with the environment.&lt;/li&gt;
&lt;li&gt;The capsule does not collide with &lt;strong&gt;Cube 1&lt;/strong&gt; because we disabled the collider for that cube but interacts with &lt;strong&gt;Cube 2&lt;/strong&gt;, which has a collider and responds to physics.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. You should now be able to control &lt;strong&gt;Cube 1&lt;/strong&gt;&#39;s position with the Z and X keys, moving it left and right, and apply impulses to &lt;strong&gt;Cube 2&lt;/strong&gt; with the C and V keys, pushing it back and forth and colliding with the capsule. 🎮&lt;/p&gt;
&lt;p&gt;This step introduces basic keyboard controls, adding interactivity to your scene and allowing the player to manipulate objects in real-time. Ready to add even more interaction? Let&#39;s move on to mouse controls next! 🖱️&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-14.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-14.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You learned how to add keyboard interaction to the scene, allowing players to move the cubes using the Z, X, C, and V keys. &lt;strong&gt;Cube 1&lt;/strong&gt; responds to continuous key presses for smooth, non-physical movement, while &lt;strong&gt;Cube 2&lt;/strong&gt; reacts to single key presses, applying impulses for physics-based movement. These controls enable dynamic interaction and real-time object manipulation within the scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 15: Add Mouse Interaction - Do something! 🖱️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s add mouse interaction to the scene! 🐭 In this step, we&#39;ll update the &lt;code&gt;Update()&lt;/code&gt; method to allow players to interact with the cubes and the capsule using the mouse 🖱️. We&#39;ll make sure both &lt;strong&gt;Cube 1&lt;/strong&gt; (non-physical movement), &lt;strong&gt;Cube 2&lt;/strong&gt;, and the capsule (physics-based movement) respond to mouse input.&lt;/p&gt;
&lt;p&gt;The previous comments have been streamlined to keep the code clean and focused🧹. Also, make sure you can see your console output to see the results of the mouse interactions.&lt;/p&gt;
&lt;p&gt;You can replace the entire code with the following, or refer to the comments labelled &lt;code&gt;// This was added&lt;/code&gt; to see the specific changes.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BepuPhysics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;CameraComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the camera component&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;BepuSimulation&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the physics simulation&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the model component of Cube 1&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a second cube with a collider for physics-based interaction&lt;/span&gt;
    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// Reposition the cube above the ground&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// These were added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Initialize camera, simulation, and model component for interactions&lt;/span&gt;
    camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetSimulation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Simulation Started&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis when the Z key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the positive X-axis when the X key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the BodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// We use KeyPressed instead of KeyDown to apply impulses only once per key press.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// This means the player needs to press and release the key to apply an impulse,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// preventing multiple impulses from being applied while the key is held down.&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the left when the C key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the right when the V key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Ensure camera and simulation are initialized before handling mouse input&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle mouse input for interactions&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HitInfo&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;camera&lt;/code&gt; stores the camera component for raycasting and ray picking.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;simulation&lt;/code&gt; stores the physics simulation for handling interactions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube1Component&lt;/code&gt; stores the model component of &lt;strong&gt;Cube 1&lt;/strong&gt; for detecting intersections with the mouse ray.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;camera.Raycast()&lt;/code&gt; detects collisions with physics-based entities using raycasting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;camera.GetPickRay()&lt;/code&gt; checks for intersections with non-physical entities using ray picking.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, when you click the left mouse button, the application will respond with the following actions depending on where you click:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clicking Outside the Ground:&lt;/strong&gt; If you click anywhere in the scene that doesn&#39;t intersect with an object or the ground, it will print &amp;quot;No hit detected.&amp;quot; This indicates that the mouse ray didn&#39;t collide with any entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on Cube 1:&lt;/strong&gt; Since &lt;strong&gt;Cube 1&lt;/strong&gt; doesn&#39;t have a collider, two things will happen:
&lt;ul&gt;
&lt;li&gt;The raycast will pass through &lt;strong&gt;Cube 1&lt;/strong&gt; and hit the ground beneath it, printing &amp;quot;Hit: Ground.&amp;quot;&lt;/li&gt;
&lt;li&gt;Additionally, the ray-picking method will detect that &lt;strong&gt;Cube 1&lt;/strong&gt; was hit, and it will print &amp;quot;Cube 1 hit!&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on Cube 2:&lt;/strong&gt; &lt;strong&gt;Cube 2&lt;/strong&gt; has a collider, so the raycast will detect the collision and print &amp;quot;Hit: Entity.&amp;quot; An impulse will be applied to &lt;strong&gt;Cube 2&lt;/strong&gt;, causing it to move upward in response to the click.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on the Capsule:&lt;/strong&gt; Similar to &lt;strong&gt;Cube 2&lt;/strong&gt;, clicking on the capsule will print &amp;quot;Hit: Entity,&amp;quot; and an upward impulse will be applied, making the capsule move.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on the Ground:&lt;/strong&gt; If you click directly on the ground, the raycast will detect it and print &amp;quot;Hit: Ground.&amp;quot; However, the ground will remain stationary because it has a &lt;code&gt;StaticColliderComponent&lt;/code&gt;, meaning it&#39;s a fixed object in the scene.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nice job! You’ve now implemented mouse interaction, which adds a whole new level of interactivity to the game. 🚀 You can now click on objects in the scene to trigger different actions, like moving cubes or capsules with physics or detecting hits on non-physical entities. This opens up endless possibilities for gameplay mechanics! 🎮 We rock! 🤘&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-15.jpg&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-15.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You&#39;ve learned how to add mouse interaction to the scene, allowing players to interact with objects using raycasting for physics-based entities and ray picking for non-physical ones. You can now click on objects to apply forces or detect hits, adding a new layer of interactivity to the game.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot; tabindex=&quot;-1&quot;&gt;Step 16: Add Output - Console or Screen! 📺 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this part, we’ll explore basic output options, both to the console and directly on the screen. You’ve already added simple text output using &lt;code&gt;Console.WriteLine()&lt;/code&gt; to display interactions when an entity is hit by the mouse raycast. Now, let&#39;s expand on this to better visualize interactions and provide feedback to the player.&lt;/p&gt;
&lt;h3 id=&quot;output-options&quot; tabindex=&quot;-1&quot;&gt;Output Options &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#output-options&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We have several options for displaying output:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Console Output:&lt;/strong&gt; Useful for debugging and logging information. This is great for developers to see real-time feedback and troubleshoot the game
&lt;ul&gt;
&lt;li&gt;We can use traditional &lt;code&gt;Console.WriteLine()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;We can also use Stride&#39;s &lt;code&gt;GlobalLogger.GetLogger()&lt;/code&gt;, or the &lt;code&gt;Log&lt;/code&gt; property when used from within a game script&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug Text Output:&lt;/strong&gt; Display text directly in the game window, which is useful for quick, in-game debugging&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI Elements:&lt;/strong&gt; Create UI elements like text labels or buttons to display information to the player within the game world.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;updating-the-console-output&quot; tabindex=&quot;-1&quot;&gt;Updating the Console Output &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#updating-the-console-output&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s update the &lt;code&gt;if (hitResult) {}&lt;/code&gt; block by adding two lines to include additional output options:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;
        rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application. You should see additional output in the console window when you click around, highlighted in green by &lt;code&gt;GlobalLogger&lt;/code&gt;. However, the text in the &lt;strong&gt;game window&lt;/strong&gt; may flash briefly, as it’s being overwritten every frame.&lt;/p&gt;
&lt;h3 id=&quot;moving-output-to-the-screen&quot; tabindex=&quot;-1&quot;&gt;Moving Output to the Screen &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#moving-output-to-the-screen&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To keep the text on the screen, move the &lt;code&gt;game.DebugTextSystem.Print()&lt;/code&gt; call to the beginning of the &lt;code&gt;Update()&lt;/code&gt; method:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This was moved&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis when the Z key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the positive X-axis when the X key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the BodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// We use KeyPressed instead of KeyDown to apply impulses only once per key press.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// This means the player needs to press and release the key to apply an impulse,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// preventing multiple impulses from being applied while the key is held down.&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the left when the C key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the right when the V key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Ensure camera and simulation are initialized before handling mouse input&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle mouse input for interactions&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HitInfo&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, when you run the application, the text &lt;strong&gt;&amp;quot;Entities:&amp;quot;&lt;/strong&gt; should remain visible on the screen at position &lt;em&gt;(50, 50)&lt;/em&gt;. This gives us some basic screen output! 📺 But since this output is more suited for debugging, let’s explore adding more polished UI elements.&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Seeing a different number of entities than expected on the screen? Debug the &lt;code&gt;Update()&lt;/code&gt;  and find out why is that 😯.&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;adding-ui-elements&quot; tabindex=&quot;-1&quot;&gt;Adding UI Elements &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#adding-ui-elements&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s create a simple text block on the canvas to display information to the player.&lt;/p&gt;
&lt;p&gt;Replace your current code with this or refer to the comments labelled &lt;code&gt;// This was added&lt;/code&gt; to see the specific changes.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BepuPhysics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Compositing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Diagnostics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Graphics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Controls&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Panels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;CameraComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Store the camera component&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;BepuSimulation&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Store the physics simulation&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Store the model component of Cube 1&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;SpriteFont&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering and UI stages&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddCleanUIStage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a second cube with a collider for physics-based interaction&lt;/span&gt;
    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// Reposition the cube above the ground&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Initialize camera, simulation, and model component for interactions&lt;/span&gt;
    camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetSimulation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Simulation Started&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This below was added: Create and display a UI text block&lt;/span&gt;
    font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Load&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;SpriteFont&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;StrideDefaultFont&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; canvas &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Canvas&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Width &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Height &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        BackgroundColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;248&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;177&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;149&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        HorizontalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; HorizontalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        VerticalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VerticalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bottom&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Children&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;TextBlock&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello, Stride!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;White&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; font&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextSize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Margin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Thickness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; uiEntity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Entity&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;UIComponent&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;UIPage&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; RootElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; canvas &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            RenderGroup &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; RenderGroup&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Group31 &lt;span class=&quot;token comment&quot;&gt;// Used to render AddCleanUIStage()&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    uiEntity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis when the Z key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the positive X-axis when the X key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the BodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// We use KeyPressed instead of KeyDown to apply impulses only once per key press.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// This means the player needs to press and release the key to apply an impulse,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// preventing multiple impulses from being applied while the key is held down.&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the left when the C key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the right when the V key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Ensure camera and simulation are initialized before handling mouse input&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle mouse input for interactions&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HitInfo&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;font&lt;/code&gt; stores the &lt;code&gt;SpriteFont&lt;/code&gt; used for the UI text block.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddCleanUIStage()&lt;/code&gt; adds a clean UI stage to the graphics compositor, allowing UI elements to be displayed on top of the 3D scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Content.Load&amp;lt;SpriteFont&amp;gt;()&lt;/code&gt; loads the default font for the UI text block.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Canvas&lt;/code&gt; is a UI panel that acts as a container for UI elements.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TextBlock&lt;/code&gt; is a UI element that displays text on the screen.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UIComponent&lt;/code&gt; is a component that manages UI elements in the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UIPage&lt;/code&gt; is a UI page that contains the root element of the UI hierarchy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RenderGroup.Group31&lt;/code&gt; specifies the rendering order of the UI element, ensuring it appears on top of other elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Save and run the application. You should now see the text &lt;strong&gt;&amp;quot;Hello, Stride!&amp;quot;&lt;/strong&gt; displayed at the bottom left corner of the screen. 📺&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Make sure that you added &lt;code&gt;AddCleanUIStage()&lt;/code&gt; .&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Congratulations! 🎉 You&#39;ve successfully added output to the screen, using both simple debugging text and a more polished UI element. This visual feedback enhances the player experience by providing real-time information and interactions. 🚀&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Output added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-16.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-16.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add various types of output, from basic console logging to real-time in-game text feedback. Using debugging text and polished UI elements, you can enhance both the developer experience and the player experience, providing essential information and interactivity in your game.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot; tabindex=&quot;-1&quot;&gt;Step 17: Break 2 - Let&#39;s Reflect 😅 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Time for a quick reflection on what we&#39;ve achieved in the last few steps. We&#39;ve significantly expanded our game&#39;s functionality and interactivity. Here&#39;s a recap:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Performance Monitoring:&lt;/strong&gt; We added a profiler to monitor key metrics like FPS, helping optimize performance for a smoother experience. You also learned how to toggle through profiler outputs to track different aspects of the game. 🚀&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Visuals:&lt;/strong&gt; By adding a skybox, we made the scene more immersive, creating a polished and professional look. 🎨&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Understanding Motion:&lt;/strong&gt; We explored the difference between non-physical and physics-based movement, learning how to decide which method to use based on game mechanics. 🧠&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical Movement:&lt;/strong&gt; You learned how to move entities using &lt;code&gt;Transform.Position&lt;/code&gt; without interacting with other objects. This approach is great for UI elements or simple animations. 🚶‍♂️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Based Movement:&lt;/strong&gt; By applying forces to entities via &lt;code&gt;BodyComponent&lt;/code&gt;, we introduced realistic interactions with gravity and collisions, adding depth to the gameplay. ⚙️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keyboard Controls:&lt;/strong&gt; We implemented basic keyboard inputs to move entities, adding interactivity and responsiveness to the game. 🎮&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mouse Controls:&lt;/strong&gt; We extended player interaction by integrating mouse clicks, allowing players to trigger actions like applying forces to entities. 🖱️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Displaying Output:&lt;/strong&gt; Finally, we explored output options, from console logs to UI elements, enhancing player feedback and communication. 📊&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entities Count:&lt;/strong&gt; While debugging, you discovered that an entity can be added to the scene without necessarily having a visual representation. You also learned that the camera, light, game profiler, and skybox are all entities as well. 🤯&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot; tabindex=&quot;-1&quot;&gt;Step 18: Add More Primitives - Let&#39;s go crazy! 🤪 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Two boxes 📦🧊 and a capsule 💊? That&#39;s not enough fun! I didn&#39;t sign up for just that! Let&#39;s crank it up and add more shapes to the scene!&lt;/p&gt;
&lt;p&gt;To do this, add the following code inside the &lt;code&gt;Update()&lt;/code&gt; method, below the &lt;code&gt;if (cube2 != null) {}&lt;/code&gt; block:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Space&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Green&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Size &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;xRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;yRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;zRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, run the application, zoom out the camera to view the entire ground, and press the &lt;strong&gt;Space&lt;/strong&gt; key. Watch as new cubes spawn, pushing your FPS to its limits! 🚀 You can still use the left mouse button to apply forces to the cubes and the capsule, but that’s getting a bit old, isn’t it? 🥱&lt;/p&gt;
&lt;p&gt;Let&#39;s spice things up with more mouse interaction, this time using the &lt;strong&gt;middle mouse button&lt;/strong&gt;. Firstly add this namespace &lt;code&gt;using Stride.CommunityToolkit.Helpers;&lt;/code&gt; and then add the following code inside the &lt;code&gt;Update()&lt;/code&gt; method, just below the line &lt;code&gt;if (camera == null || simulation == null || !game.Input.HasMouse) return;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Middle&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HitInfo&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The final code is also available on &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasics/Program.cs&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Run the application, and now, whenever you click the middle mouse button on an object, it will get a random impulse in a random direction. 🎲 How cool is that?&lt;/p&gt;
&lt;div class=&quot;alert alert-warning d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#warning&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;More cubes = more responsibility! Keep an eye on performance. Once cubes float too far away into the void, consider removing them from the scene to maintain performance. We will cover this in Part 2 of the series.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You&#39;ve now learned how to create more primitives using keyboard input and apply random forces to objects with the middle mouse button - all in just around &lt;strong&gt;250&lt;/strong&gt; lines of code.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot; tabindex=&quot;-1&quot;&gt;Wrapping Up: Your Journey Continues 🎯 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Congratulations, explorer! 🎉 You&#39;ve navigated through another significant chapter in your game development journey. 🌍 In this part, you delved deeper into interactivity, mastering how to implement mouse and keyboard controls to make your game more dynamic and engaging.&lt;/p&gt;
&lt;h3 id=&quot;what-you&#39;ve-achieved&quot; tabindex=&quot;-1&quot;&gt;What You&#39;ve Achieved &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#what-you&#39;ve-achieved&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;By adding mouse interactions, you’ve empowered players to directly interact with objects in your scene using techniques like raycasting and ray picking. Combined with the keyboard controls you implemented earlier, your game now responds to player inputs, allowing for real-time movement, actions, and feedback. 🖱️⌨️&lt;/p&gt;
&lt;h3 id=&quot;the-power-of-interactivity&quot; tabindex=&quot;-1&quot;&gt;The Power of Interactivity &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#the-power-of-interactivity&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Interactivity is at the heart of game design. By giving players the ability to influence the game world, you create a more immersive and engaging experience. The skills you&#39;ve developed—handling inputs, moving objects, managing physics, and providing feedback—are foundational to building more complex and polished games. 🌟&lt;/p&gt;
&lt;p&gt;If you&#39;d like to explore the final code for this project, you can access it on &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasics/Program.cs&quot;&gt;GitHub&lt;/a&gt;. Feel free to check it out and experiment! 💻&lt;/p&gt;
&lt;h2 id=&quot;follow-up-articles-%F0%9F%9A%B6&quot; tabindex=&quot;-1&quot;&gt;Follow-Up Articles 🚶 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#follow-up-articles-%F0%9F%9A%B6&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the not-so-distant future, we will cover the following topics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stride Community Toolkit Preview - Code-Only Feature - Advanced:&lt;/strong&gt; Let&#39;s get creative and explore more advanced features to take your game to the next level. 🚀
&lt;ul&gt;
&lt;li&gt;Maximize the game window&lt;/li&gt;
&lt;li&gt;Setting the Game Window Title&lt;/li&gt;
&lt;li&gt;Hot reload&lt;/li&gt;
&lt;li&gt;Removing entities from the scene&lt;/li&gt;
&lt;li&gt;Entities vs Children vs Components&lt;/li&gt;
&lt;li&gt;Interaction with the UI and from the UI&lt;/li&gt;
&lt;li&gt;Transforming entities&lt;/li&gt;
&lt;li&gt;Advanced physics interactions&lt;/li&gt;
&lt;li&gt;Audio and sound effects&lt;/li&gt;
&lt;li&gt;Particle effects&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stride Community Toolkit Preview - Code-Only Feature - Refactoring:&lt;/strong&gt; Let&#39;s refactor the code to make it more modular, reusable, and maintainable. 🛠️
&lt;ul&gt;
&lt;li&gt;Or in other words, let’s clean up the mess we made! 😅&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;support-stride-engine-%F0%9F%8C%9F&quot; tabindex=&quot;-1&quot;&gt;Support Stride Engine 🌟 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Stride is an open-source project that thrives on community contributions and support. By using Stride, sharing your experiences, and contributing to the community, you help make the engine better for everyone. 🚀&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contribute:&lt;/strong&gt; Share your knowledge, &lt;a href=&quot;https://github.com/stride3d/stride&quot;&gt;contribute to the engine&lt;/a&gt;, or &lt;a href=&quot;https://github.com/stride3d/stride/issues&quot;&gt;report issues&lt;/a&gt; to help improve Stride for all developers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Join the Community:&lt;/strong&gt; Engage with fellow developers, ask questions, and showcase your projects on our &lt;a href=&quot;https://discord.gg/f6aerfE&quot;&gt;Discord&lt;/a&gt; server or in &lt;a href=&quot;https://github.com/stride3d/stride/discussions&quot;&gt;GitHub Discussions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sponsor:&lt;/strong&gt; Support the continued development of Stride by becoming a sponsor on our &lt;a href=&quot;https://opencollective.com/stride3d&quot;&gt;Open Collective&lt;/a&gt; page.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-light d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#light&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;This content was reviewed and enhanced with the assistance of ChatGPT.&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Stride Community Toolkit Preview - Code-Only Feature Basics in C# - Bullet Physics</title>
    <link href="https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/"/>
    <updated>2024-09-22T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/</id>
    <content xml:lang="en" type="html">&lt;p&gt;Discover the Stride Community Toolkit, a powerful collection of extensions and helpers designed for the Stride game engine. In this blog post (Bullet Physics version), we dive into the toolkit&#39;s &lt;strong&gt;code-only&lt;/strong&gt; feature, empowering C# and .NET developers to create immersive 2D/3D games and visualizations with ease. Explore how this community-driven, open-source project can simplify your game development journey.&lt;/p&gt;
&lt;p&gt;This blog post is part 1 of a 3-part series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/&quot;&gt;Stride Community Toolkit Preview - Code-Only Feature - Basics (C#)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics&quot;&gt;Bepu Physics version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Also available: &lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp&quot;&gt;Condensed F# version of this tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/examples/capsule-with-rigid-body-vb.html&quot;&gt;Visual Basic version is also possible&lt;/a&gt; but I am running out of space here 😅&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Stride Community Toolkit Preview - Code-Only Feature - Advanced&lt;/li&gt;
&lt;li&gt;Stride Community Toolkit Preview - Code-Only Feature - Refactoring&lt;/li&gt;
&lt;/ul&gt;
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; style=&quot;display: none;&quot;&gt;
    &lt;symbol id=&quot;success&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;info&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;light&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;warning&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;danger&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
&lt;/svg&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;This blog post targets Bullet Physics. A separate blog post was published (Bepu Physics link above), which is now the preferred physics engine for Stride. Feel free to continue with this tutorial to get familiar with the core concepts, which remain the same.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Table of Contents:&lt;/p&gt;
&lt;div class=&quot;table-of-contents&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#introduction-%F0%9F%8C%B1&quot;&gt;Introduction 🌱&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#what-you&#39;ll-learn-%F0%9F%8E%AF&quot;&gt;What You&#39;ll Learn 🎯&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#basic-terminology-%F0%9F%93%9A&quot;&gt;Basic Terminology 📚&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#prerequisites-%F0%9F%8F%A0&quot;&gt;Prerequisites 🏠&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#how-to-use-the-code-snippets-%F0%9F%93%9D&quot;&gt;How to use the code snippets 📝&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#code-only-on-windows-%F0%9F%AA%9F&quot;&gt;Code-Only on Windows 🪟&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#code-only-on-other-platforms-%F0%9F%90%A7&quot;&gt;Code-Only on Other Platforms 🐧&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#the-story-of-the-brave-explorers-%F0%9F%93%98&quot;&gt;The Story of the Brave Explorers 📘&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot;&gt;Step 1: Create a New C# .NET 10 Console App - Nothingness ⚫&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot;&gt;Step 2: Let There Be Light - Or at Least Blue 🌌&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot;&gt;Step 3: Add Some Shapes - Capsule Time! 🎨&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;Step 4: Control the Camera - Look Around! 🖱️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot;&gt;Step 5: Reposition the Capsule - More Excitement! 📍&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot;&gt;Step 6: Add a Ground - Catch the Capsule! 🛑&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot;&gt;Step 7: Illuminate the Scene - Add Light! 💡&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;Step 8: Break 1 - Let&#39;s Reflect 😅&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot;&gt;Step 9: Add Profiler - Performance! 📈&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot;&gt;Step 10: Illuminate the Scene - Add Skybox! 🌇&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot;&gt;Step 11: Add Motion - I like to Move It, Move It! 🕺&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-entities-by-changing-their-position-directly-(without-colliders)&quot;&gt;Moving Entities by Changing Their Position Directly (Without Colliders)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-entities-using-physics-(with-colliders)&quot;&gt;Moving Entities Using Physics (With Colliders)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot;&gt;Step 12: Add Motion without Physics - Move the Cube without Colliders 📦&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot;&gt;Step 13: Add Motion with Physics - Move the Cube with Colliders! 🧊&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot;&gt;Step 14: Add Keyboard Interaction - Move the Cube! ⌨️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;Step 15: Add Mouse Interaction - Do something! 🖱️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot;&gt;Step 16: Add Output - Console or Screen! 📺&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#output-options&quot;&gt;Output Options&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#updating-the-console-output&quot;&gt;Updating the Console Output&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-output-to-the-screen&quot;&gt;Moving Output to the Screen&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#adding-ui-elements&quot;&gt;Adding UI Elements&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;Step 17: Break 2 - Let&#39;s Reflect 😅&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot;&gt;Step 18: Add More Primitives - Let&#39;s go crazy! 🤪&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot;&gt;Wrapping Up: Your Journey Continues 🎯&lt;/a&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#what-you&#39;ve-achieved&quot;&gt;What You&#39;ve Achieved&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#the-power-of-interactivity&quot;&gt;The Power of Interactivity&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#follow-up-articles-%F0%9F%9A%B6&quot;&gt;Follow-Up Articles 🚶&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;Support Stride Engine 🌟&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;h2 id=&quot;introduction-%F0%9F%8C%B1&quot; tabindex=&quot;-1&quot;&gt;Introduction 🌱 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#introduction-%F0%9F%8C%B1&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Welcome to the preview of the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/index.html&quot;&gt;Stride Community Toolkit&lt;/a&gt;, a collection of extensions and helpers for the &lt;a href=&quot;https://www.stride3d.net/&quot;&gt;Stride&lt;/a&gt; C# game engine. This community-driven, &lt;a href=&quot;https://github.com/stride3d/stride-community-toolkit&quot;&gt;open-source project&lt;/a&gt; is designed to assist developers in creating 2D/3D games and visualizations using &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/index.html&quot;&gt;Stride&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Although the toolkit is still in its early stages, it already offers several valuable features. In this post, I will focus on the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;code-only&lt;/a&gt; approach, which I found particularly useful for development.&lt;/p&gt;
&lt;p&gt;This article assumes that you have some experience with .NET and C# programming.&lt;/p&gt;
&lt;p&gt;The toolkit allows you to create a game using a code-only approach, meaning you can develop a game without relying on the Stride &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/index.html&quot;&gt;Game Studio&lt;/a&gt;. As a C#/.NET developer in my day job, I found this approach very helpful for getting started with the &lt;a href=&quot;https://github.com/stride3d/stride&quot;&gt;Stride engine&lt;/a&gt; and game development, bypassing the need to work directly in the Game Studio.&lt;/p&gt;
&lt;p&gt;You can also access the &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasicsBulletPhysics/Program.cs&quot;&gt;full source code for this post on GitHub&lt;/a&gt; to follow along or explore the final implementation directly.&lt;/p&gt;
&lt;p&gt;Additional details on the benefits of the code-only approach can be found &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;here&lt;/a&gt; in the toolkit documentation.&lt;/p&gt;
&lt;p&gt;We will be using a standard &lt;a href=&quot;https://learn.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio&quot;&gt;.NET 10 Console App&lt;/a&gt; to create a simple game by adding some NuGet packages to get started.&lt;/p&gt;
&lt;p&gt;Here’s the process I found to be the easiest way to begin with the code-only approach:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run the minimal code to get the game window running&lt;/li&gt;
&lt;li&gt;Add entities/primitives to the scene&lt;/li&gt;
&lt;li&gt;Add interaction with the keyboard and mouse&lt;/li&gt;
&lt;li&gt;Add output to the console or screen&lt;/li&gt;
&lt;li&gt;Play around, be creative and have fun&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;what-you&#39;ll-learn-%F0%9F%8E%AF&quot; tabindex=&quot;-1&quot;&gt;What You&#39;ll Learn 🎯 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#what-you&#39;ll-learn-%F0%9F%8E%AF&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By the end of this post, you will have a solid foundation in using the Stride Community Toolkit&#39;s code-only feature to create a simple game. You’ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up the game window and initialize the core components&lt;/li&gt;
&lt;li&gt;Add and manipulate entities within the scene&lt;/li&gt;
&lt;li&gt;Implement basic interactivity using the keyboard and mouse&lt;/li&gt;
&lt;li&gt;Display text output to the console or directly on the screen for debugging or player feedback&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Coding enhances creativity and problem-solving, and we can take that creativity to the next level through visualization, whether it&#39;s in games, simulations, or simply experimenting with 3D models in a virtual space.&lt;/p&gt;
&lt;p&gt;Whether you’re a seasoned developer or new to game development, this post will guide you through the essential steps to get your first game up and running with Stride. Ready to dive in? Let’s get started! 🚀&lt;/p&gt;
&lt;h2 id=&quot;basic-terminology-%F0%9F%93%9A&quot; tabindex=&quot;-1&quot;&gt;Basic Terminology 📚 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#basic-terminology-%F0%9F%93%9A&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving into the steps, it&#39;s helpful to understand some key terms that will be used throughout this guide:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.stride3d.net/&quot;&gt;Stride&lt;/a&gt;: A C# game engine for creating 2D/3D games and visualizations.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/index.html&quot;&gt;Stride Community Toolkit&lt;/a&gt;: A collection of extensions and helpers for the Stride engine.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Bepu Physics&lt;/a&gt;: The preferred physics engine for Stride, providing advanced &lt;a href=&quot;https://github.com/bepu/bepuphysics2&quot;&gt;Bepu physics&lt;/a&gt; simulation capabilities.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics-bullet/index.html&quot;&gt;Bullet Physics&lt;/a&gt;: An alternative physics engine for Stride, which is being phased out in favor of Bepu Physics.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/index.html&quot;&gt;Code-Only&lt;/a&gt;: A feature of the toolkit that allows you to create a game without using the Game Studio.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.Game.html&quot;&gt;Game&lt;/a&gt;: In the context of this post, a game refers to any interactive or visual project created using a game engine. This can range from traditional playable games to simulations, visualizations, or any real-time interactive experiences where users can interact with or observe elements within a scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/scenes.html&quot;&gt;Scene&lt;/a&gt;: The container for entities, which defines the game world or environment.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.Entity.html&quot;&gt;Entity&lt;/a&gt;: An object in the scene that can represent anything from a 3D model to a camera or light and aggregates multiple EntityComponents.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Engine.EntityComponent.html&quot;&gt;EntityComponent&lt;/a&gt;: A base component that defines the behavior or properties of an entity. Other components inherit from this class.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Physics.RigidbodyComponent.html&quot;&gt;RigidbodyComponent&lt;/a&gt;: A physics component that allows an entity to respond to forces like gravity and collisions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;Graphics Compositor&lt;/a&gt;: A component that organizes how scenes are rendered in the Stride engine.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/cameras/index.html&quot;&gt;Camera&lt;/a&gt;: A camera that allows viewing the scene from different angles.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpintermediate/third-person-camera.html&quot;&gt;Camera Controller&lt;/a&gt;: A script that enables basic camera movement using keyboard and mouse inputs.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Graphics.GeometricPrimitives.GeometricPrimitive.Cube.html&quot;&gt;3D Primitive&lt;/a&gt;: A basic 3D model, such as a capsule, cube, or sphere.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/colliders.html&quot;&gt;Collider&lt;/a&gt;: A component that defines the shape of an entity for physical interactions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/index.html&quot;&gt;Physics Engine&lt;/a&gt;: A system that simulates physical interactions between entities in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/troubleshooting/profiling.html&quot;&gt;Profiler&lt;/a&gt;: A tool that monitors performance metrics like frames per second (FPS) and memory usage.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;Skybox&lt;/a&gt;: A textured 3D model that provides a background for the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Video_game_programming#Game_structure&quot;&gt;Game Loop&lt;/a&gt;: The main loop that drives the game, updating the state and rendering the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/scripts/types-of-script.html#synchronous-scripts&quot;&gt;Update Method&lt;/a&gt;: A callback method that is called every frame to update the game state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Based Movement:&lt;/strong&gt; Moving entities using the physics engine to simulate realistic interactions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical Movement:&lt;/strong&gt; Moving entities by directly changing their position without physics interactions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpbeginner/transform-position.html&quot;&gt;Transform&lt;/a&gt;: Defines an entity&#39;s position, rotation, and scale in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Physics.RigidbodyComponent.html?q=Force#Stride_Physics_RigidbodyComponent_ApplyForce_Stride_Core_Mathematics_Vector3_&quot;&gt;Force&lt;/a&gt;: A vector that represents a physical force applied to an &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/rigid-bodies.html&quot;&gt;entity&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpbeginner/delta-time.html&quot;&gt;Delta Time&lt;/a&gt;: The time elapsed between frames, used for frame-independent movement.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/materials/index.html&quot;&gt;Material&lt;/a&gt;: A visual property that defines how an entity is rendered, including color, texture, and shading.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/api/Stride.CommunityToolkit.Engine.GameExtensions.html#Stride_CommunityToolkit_Engine_GameExtensions_AddGroundGizmo_Stride_Engine_Game_System_Nullable_Stride_Core_Mathematics_Vector3__System_Boolean_System_Boolean_&quot;&gt;Ground Gizmo&lt;/a&gt;: A visual representation of the ground plane and axis directions in the scene.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Games.GameTime.html&quot;&gt;GameTime&lt;/a&gt;: A structure that provides time-related information for the game loop.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Core.Mathematics.Vector3.html&quot;&gt;Vector3&lt;/a&gt;: A 3D vector that represents a point or direction in 3D space.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Frame_rate&quot;&gt;Frame Rate&lt;/a&gt;: The number of frames rendered per second, measured in frames per second (FPS).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;prerequisites-%F0%9F%8F%A0&quot; tabindex=&quot;-1&quot;&gt;Prerequisites 🏠 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#prerequisites-%F0%9F%8F%A0&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These prerequisites were tested on a clean Windows 11 installation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://aka.ms/vc14/vc_redist.x64.exe&quot;&gt;Microsoft Visual C++ v14 Redistributable (x64)&lt;/a&gt; (approximately 19MB) and restart your system if prompted.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://dotnet.microsoft.com/en-us/download&quot;&gt;.NET 10 SDK x64&lt;/a&gt; (around 215MB).&lt;/li&gt;
&lt;li&gt;Install the IDE of your choice. I will be using &lt;a href=&quot;https://visualstudio.microsoft.com/downloads/&quot;&gt;Visual Studio 2026&lt;/a&gt; (the Community version is free), but you can also use:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;Visual Studio Code&lt;/a&gt; - Free&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.jetbrains.com/rider/download/#section=windows&quot;&gt;Rider&lt;/a&gt; - Free for non-commercial use&lt;/li&gt;
&lt;li&gt;Any other IDE that supports .NET development&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;how-to-use-the-code-snippets-%F0%9F%93%9D&quot; tabindex=&quot;-1&quot;&gt;How to use the code snippets 📝 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#how-to-use-the-code-snippets-%F0%9F%93%9D&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can copy and paste the code into your &lt;code&gt;Program.cs&lt;/code&gt; file and run the application to see the results.&lt;/p&gt;
&lt;p&gt;You will be guided to replace some parts of the code with the new code snippets as you progress through the steps or replacing the entire &lt;code&gt;Program.cs&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Also, the code snippets contain comments which part of the code is new or updated.&lt;/p&gt;
&lt;h2 id=&quot;code-only-on-windows-%F0%9F%AA%9F&quot; tabindex=&quot;-1&quot;&gt;Code-Only on Windows 🪟 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#code-only-on-windows-%F0%9F%AA%9F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The code-only approach is currently available only on Windows. The toolkit provides a set of NuGet packages that you can use to create a game without the need for the Game Studio.&lt;/p&gt;
&lt;h2 id=&quot;code-only-on-other-platforms-%F0%9F%90%A7&quot; tabindex=&quot;-1&quot;&gt;Code-Only on Other Platforms 🐧 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#code-only-on-other-platforms-%F0%9F%90%A7&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Code-only development isn&#39;t fully supported on non-Windows platforms yet, but progress is being made. Thanks to &lt;a href=&quot;https://github.com/stride3d/stride/pull/2279&quot;&gt;this PR&lt;/a&gt;, the build tool &lt;code&gt;Stride.Core.Assets.CompilerApp&lt;/code&gt;, which is responsible for building assets, now works on Linux as a cross-platform binary.&lt;/p&gt;
&lt;p&gt;However, there are still some limitations. A known workaround for Linux (Ubuntu) is documented here: &lt;a href=&quot;https://github.com/stride3d/stride/issues/2596&quot;&gt;Code-Only Development on Linux (Ubuntu) Requires Manual File Copying&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While Stride is a cross-platform engine and you can build your game on Windows and run it elsewhere, full support for code-only workflows on platforms like Linux is still evolving.&lt;/p&gt;
&lt;h2 id=&quot;the-story-of-the-brave-explorers-%F0%9F%93%98&quot; tabindex=&quot;-1&quot;&gt;The Story of the Brave Explorers 📘 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#the-story-of-the-brave-explorers-%F0%9F%93%98&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;🌍 Welcome, brave explorers of the digital wilderness! Today, we embark on an exciting journey into the heart of the Stride game engine. Our guide? None other than the Stride Community Toolkit.&lt;/p&gt;
&lt;p&gt;In the vast expanse of the coding universe, we&#39;ll create a new world from nothing but a .NET 10 Console App. Prepare to witness the birth of a game window, a black void of nothingness that will soon teem with life 🫎.&lt;/p&gt;
&lt;p&gt;As we venture further, we&#39;ll bring light into our world, transforming the empty void into a vibrant blue expanse. But what&#39;s a world without inhabitants? We&#39;ll conjure a 3D capsule, our first digital lifeform, into existence.&lt;/p&gt;
&lt;p&gt;Beware, fellow adventurers! Our capsule is a wild creature, prone to falling into the void. But fear not, for we&#39;ll harness the power of a 3D camera 🎥 controller to keep a watchful eye 👁️ on our creation.&lt;/p&gt;
&lt;p&gt;As we continue, we&#39;ll introduce motion, allowing our entities to interact with their surroundings and respond to player input. From keyboard controls to mouse interactions, our world will come to life with movement and action. 🕹️&lt;/p&gt;
&lt;p&gt;Finally, we’ll display messages and feedback with both console output and on-screen text, letting our creation communicate with us through the game window. 📝&lt;/p&gt;
&lt;p&gt;So, refresh your mouse agility skills 🖱️, and join us on this exhilarating expedition. Let&#39;s dive into the code! 💻&lt;/p&gt;
&lt;h2 id=&quot;step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot; tabindex=&quot;-1&quot;&gt;Step 1: Create a New C# .NET 10 Console App - Nothingness ⚫ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-1%3A-create-a-new-c%23-.net-10-console-app---nothingness-%E2%9A%AB&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a new C# .NET 10 Console App in your IDE or use the command line:&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet new console &lt;span class=&quot;token parameter variable&quot;&gt;--framework&lt;/span&gt; net10.0 &lt;span class=&quot;token parameter variable&quot;&gt;--name&lt;/span&gt; YourProjectName&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add the following NuGet package: 📦&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Windows &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Paste the following code into your &lt;code&gt;Program.cs&lt;/code&gt; file: 💻&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Build the project from the command line or use your IDE to build it:&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet build&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the application.&lt;/li&gt;
&lt;li&gt;Behold the black void of nothingness 🙀.&lt;/li&gt;
&lt;/ol&gt;
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; style=&quot;display: none;&quot;&gt;
    &lt;symbol id=&quot;success&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;info&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;light&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;warning&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;danger&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
&lt;/svg&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;If you&#39;re still on Stride 4.2, use &lt;code&gt;--version 1.0.0-preview.61&lt;/code&gt; instead of &lt;code&gt;--prerelease&lt;/code&gt;, which targets Stride 4.3. This applies to all NuGet packages mentioned below.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;The NuGet package &lt;code&gt;Stride.CommunityToolkit.Windows&lt;/code&gt; is used specifically for code-only projects. You should use the &lt;code&gt;Stride.CommunityToolkit&lt;/code&gt; NuGet package when referencing from a regular Stride project generated from the Game Studio.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to set up a Stride game window using the Stride Community Toolkit. Even though it&#39;s just a black screen, the game window is running, marking the first step in your journey.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot; tabindex=&quot;-1&quot;&gt;Step 2: Let There Be Light - Or at Least Blue 🌌 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-2%3A-let-there-be-light---or-at-least-blue-%F0%9F%8C%8C&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once upon a time in a galaxy far, far away, you should see a window with a black background. This is the Stride game window. 🖥️ As a black screen is not very exciting, let&#39;s add some mystery code to make it more interesting. This time, we use the &lt;code&gt;Stride.CommunityToolkit.Engine&lt;/code&gt; namespace so we can reference some of the toolkit helper methods. 🔧✨&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Import the toolkit&#39;s helper methods&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The code above does the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Start()&lt;/code&gt; method is a callback that is invoked when the game starts. It takes a &lt;code&gt;Scene&lt;/code&gt; object as a parameter, representing the root scene of the game.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddGraphicsCompositor()&lt;/code&gt; organizes &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;how scenes are rendered&lt;/a&gt; in the Stride engine, enabling extensive customization of the rendering pipeline.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Add3DCamera()&lt;/code&gt; adds a 3D camera to the scene, allowing you to view it from various angles.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. Now, instead of a black screen, you should see a blue screen. 🌌 While not overly exciting, it’s a step in the right direction. We’re looking through the camera, but there’s nothing to see yet. 👀&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned that Graphics Compositor is used to handle rendering and 3D Camera is used to view the scene from different angles. There&#39;s still nothing to see yet because we haven’t added any objects to the scene. 🤷‍♂️&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot; tabindex=&quot;-1&quot;&gt;Step 3: Add Some Shapes - Capsule Time! 🎨 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-3%3A-add-some-shapes---capsule-time!-%F0%9F%8E%A8&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Firstly, we need to add another NuGet package, &lt;code&gt;Stride.CommunityToolkit.Bullet&lt;/code&gt;, which includes the Bullet physics engine. This package is required for the physics engine to work properly. You can add it using the following command:&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Bullet &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now let&#39;s add something to the scene. 🎨 This time, we will be utilizing the &lt;code&gt;Stride.CommunityToolkit.Rendering.ProceduralModels&lt;/code&gt; namespace, which provides helper methods for generating procedural models like capsules, cubes, and spheres. We will add a capsule to the scene.&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Import the Bullet physics engine&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import procedural model helpers&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this step, we added a new line that creates a 3D primitive capsule. 🧊 The &lt;code&gt;Create3DPrimitive()&lt;/code&gt; method takes a &lt;code&gt;PrimitiveModelType&lt;/code&gt; enum as a parameter and returns an &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/game-studio/add-entities.html&quot;&gt;&lt;code&gt;Entity&lt;/code&gt;&lt;/a&gt; object, with a collider included by default. The &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/api/Stride.CommunityToolkit.Rendering.ProceduralModels.PrimitiveModelType.html&quot;&gt;&lt;code&gt;PrimitiveModelType&lt;/code&gt;&lt;/a&gt; enum defines the types of primitive 3D models that can be generated, such as capsules, cubes, and spheres.&lt;/p&gt;
&lt;p&gt;Run the application again. Surprise, nothing happened! 😲🤬 We created an entity, but we didn&#39;t add it to the scene. This is a typical beginner&#39;s mistake 🤦‍♂️. To fix it, update the &lt;code&gt;Start()&lt;/code&gt; method to look like this.&lt;/p&gt;
&lt;p&gt;You can replace the entire &lt;code&gt;Start()&lt;/code&gt; method with the code below:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera to the scene to allow viewing from different angles&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, run the application again. You should see a capsule in the middle of the screen if you&#39;re lucky because it&#39;s falling down. Fast! 🚀&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Capsule in blue game window&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-3.webp&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-3.webp&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to create and add a 3D capsule to the scene using procedural models. By adding the entity to the root scene, it becomes part of the scene graph. The capsule is falling because it lacks a collider to interact with the ground, which we&#39;ll address later.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 4: Control the Camera - Look Around! 🖱️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-4%3A-control-the-camera---look-around!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Maybe we should at least look around the scene and view the capsule from different angles as it falls into the void 🤔?&lt;/p&gt;
&lt;p&gt;Let&#39;s add a 3D camera controller using the &lt;code&gt;Add3DCameraController()&lt;/code&gt; method. 🎮 This extension adds basic camera functionality, allowing you to interact with the camera through keyboard and mouse inputs. Specifically, it attaches a regular &lt;code&gt;SyncScript&lt;/code&gt; to the camera with custom logic to handle camera movement.&lt;/p&gt;
&lt;p&gt;In most games, you would implement your own custom camera logic to fit the specific needs of your game. However, for this example, we&#39;ll use the default camera controller to get basic camera movement up and running quickly.&lt;/p&gt;
&lt;p&gt;Time to refresh those mouse agility skills!&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// This was updated: Add a camera controller for basic camera movement&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again and use right-click and hold to rotate the camera towards the capsule, or follow the instructions displayed on the screen. 🎥 Feeling a bit more satisfied now? Let’s make the experience even more interesting! 🎨✨&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Game controller instructions&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-4.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-4.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a 3D camera controller to the scene, enabling basic camera movement. Now, you can rotate the camera using the mouse and keyboard, giving you more control over how you view the scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot; tabindex=&quot;-1&quot;&gt;Step 5: Reposition the Capsule - More Excitement! 📍 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-5%3A-reposition-the-capsule---more-excitement!-%F0%9F%93%8D&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s reposition the capsule to add a bit more excitement and give us a few extra seconds to admire it before it falls. Update the &lt;code&gt;Start()&lt;/code&gt; method as shown below, and don&#39;t forget to add the &lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; namespace for handling the 3D positioning.&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Make sure that &lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; is used instead of &lt;code&gt;System.Numerics&lt;/code&gt; which also contains &lt;code&gt;Vector3&lt;/code&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Update the &lt;code&gt;Program.cs&lt;/code&gt; file to look like this, or simply replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import Vector3 and other math utilities&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;entity.Transform.Position&lt;/code&gt; sets the position of the entity within the scene. The &lt;code&gt;Vector3&lt;/code&gt; object represents a 3D vector, which in this case, places the capsule at coordinates &lt;code&gt;(0, 8, 0)&lt;/code&gt;, which is 8 units above the scene&#39;s origin.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Stride.Core.Mathematics&lt;/code&gt; Stride uses its own implementation of &lt;code&gt;Vector3&lt;/code&gt; and other math utilities, so we need to add this namespace to access those features.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. You should see a capsule falling down from the top of the screen. I know, the capsule is black, but don&#39;t worry, we&#39;ll fix that later. 😉&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Reposition Capsule&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-5.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-5.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to reposition the capsule in the scene using the &lt;code&gt;Transform&lt;/code&gt; component&#39;s &lt;code&gt;Position&lt;/code&gt; property. The capsule is now positioned 8 units above the origin, giving you more time to admire it as it falls into the void.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot; tabindex=&quot;-1&quot;&gt;Step 6: Add a Ground - Catch the Capsule! 🛑 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-6%3A-add-a-ground---catch-the-capsule!-%F0%9F%9B%91&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now let&#39;s catch the capsule by adding some ground to the scene. Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this so we can feel more grounded.&lt;/p&gt;
&lt;p&gt;You can replace the entire &lt;code&gt;Start()&lt;/code&gt; method with the code below:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Add3DGround()&lt;/code&gt; is a toolkit helper method that creates a 3D ground plane in the scene, providing a surface for the capsule to land on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application again. You should see the capsule falling down and landing on the ground. 🎉 Unfortunately, it&#39;s still a black capsule on a black ground 🤦‍♂️. But don&#39;t worry, we’ll fix that later! In the meantime, you can move the camera around using the mouse and keyboard (Q or E) to lower or raise the camera and watch the capsule roll around on the ground. 🖱️⌨️&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;If you&#39;re wondering why the ground is invisible from below, it&#39;s due to back face culling. This technique prevents the engine from drawing polygons that face away from the camera, improving performance by avoiding unnecessary rendering. The same applies to the cube and other primitives: if the camera is inside the object, the walls won&#39;t be visible.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;row mb-2&quot;&gt;
    &lt;div class=&quot;col-6&quot;&gt;
    &lt;a href=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6a.jpg&quot; title=&quot;Stride Game Engine - Code Only Basic - Ground added&quot; class=&quot;mb-2&quot;&gt;&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Ground added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6a.jpg&quot; class=&quot;img-fluid&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-6a.jpg&quot; /&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class=&quot;col-6&quot;&gt;
    &lt;a href=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6b.jpg&quot; title=&quot;Stride Game Engine - Code Only Basic - Ground, different angle&quot; class=&quot;mb-2&quot;&gt;&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Ground, different angle&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-6b.jpg&quot; class=&quot;img-fluid&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-6b.jpg&quot; /&gt;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a 3D ground plane to the scene, giving the capsule a surface to land on. Now, the capsule falls and lands on the ground, making the scene feel more dynamic.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot; tabindex=&quot;-1&quot;&gt;Step 7: Illuminate the Scene - Add Light! 💡 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-7%3A-illuminate-the-scene---add-light!-%F0%9F%92%A1&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It&#39;s time to brighten things up! Adding some light to the scene will help us see our objects more clearly. Thankfully, there&#39;s a helper method called &lt;code&gt;AddDirectionalLight()&lt;/code&gt; that adds a directional light to the scene. Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. 🌟 You should now see the capsule falling down and landing on the ground, with everything clearly illuminated by the directional light. The capsule and ground are much easier to see, thanks to the added light shining on the scene. 🎉&lt;/p&gt;
&lt;p&gt;Finally, no more black-on-black mysteries! 💡&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Light added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-7.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-7.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a directional light to the scene, illuminating both the capsule and the ground. The scene is now well-lit, making it much easier to see and interact with the objects.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot; tabindex=&quot;-1&quot;&gt;Step 8: Break 1 - Let&#39;s Reflect 😅 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-8%3A-break-1---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Tedious work, but you just learned the very basics of game setup behind the scenes, which is usually done in the Game Studio for you automatically.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/graphics-compositor/index.html&quot;&gt;Graphics Compositor&lt;/a&gt; to render the scene&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/cameras/index.html&quot;&gt;Camera&lt;/a&gt; to view the scene&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/tutorials/csharpintermediate/third-person-camera.html&quot;&gt;Camera Controller&lt;/a&gt; to move the camera around. This is a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/scripts/index.html&quot;&gt;C# script&lt;/a&gt; that controls the camera&#39;s position and orientation&lt;/li&gt;
&lt;li&gt;You need a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/lights-and-shadows/index.html&quot;&gt;Light&lt;/a&gt; to illuminate the scene&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once the basics are set up, you need to add entities to the scene. In our example, we added:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A 3D Ground, a simple primitive model that provides a surface.&lt;/li&gt;
&lt;li&gt;A Capsule, another primitive model, which we’ve repositioned and dropped into the scene.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The toolkit added &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics/colliders.html&quot;&gt;colliders&lt;/a&gt; for the ground and capsule, ensuring that the capsule doesn&#39;t fall through the ground but instead interacts realistically with the scene.&lt;/p&gt;&lt;div class=&quot;alert alert-info d-flex&quot;&gt;&lt;br /&gt;
&lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;br /&gt;
&lt;div&gt;You can review the implementation of each &lt;a href=&quot;https://github.com/stride3d/stride-community-toolkit/tree/main/src/Stride.CommunityToolkit&quot;&gt;Stride toolkit extension&lt;/a&gt;, which wraps some boilerplate code, and create your own custom implementation.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Whew! 😅 Take a deep breath, and get ready for the next part of our journey. Up next: performance optimizations and more interactive elements. 🚀&lt;/p&gt;
&lt;h2 id=&quot;step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot; tabindex=&quot;-1&quot;&gt;Step 9: Add Profiler - Performance! 📈 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-9%3A-add-profiler---performance!-%F0%9F%93%88&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As game developers, we love seeing those sweet FPS numbers! 🎮 The toolkit provides a &lt;code&gt;AddProfiler()&lt;/code&gt; method that adds a performance profiler to the game, allowing us to monitor important metrics like frames per second (FPS).&lt;/p&gt;
&lt;p&gt;Update the &lt;code&gt;Start()&lt;/code&gt; method to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. You should see &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/troubleshooting/profiling.html&quot;&gt;profiler text output&lt;/a&gt; in the top-left corner of the screen, showing the frames per second (FPS) and other performance metrics. 🚀 Press F1 to cycle through different profiler outputs and monitor various aspects of your game&#39;s performance. 📊&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Profiler added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-9.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-9.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a performance profiler to the scene, enabling you to monitor FPS and other important metrics. The profiler provides valuable insights into your game&#39;s performance, helping you identify areas for optimization.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot; tabindex=&quot;-1&quot;&gt;Step 10: Illuminate the Scene - Add Skybox! 🌇 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-10%3A-illuminate-the-scene---add-skybox!-%F0%9F%8C%87&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As exciting as things are looking, we can make our scene even better by adding a &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;skybox&lt;/a&gt;. A skybox will enhance the overall atmosphere and give our scene a more polished, realistic look. 🌇&lt;/p&gt;
&lt;p&gt;The toolkit provides a &lt;code&gt;AddSkybox()&lt;/code&gt; method that adds a skybox to the scene. First, we need to add another NuGet package, &lt;code&gt;Stride.CommunityToolkit.Skyboxes&lt;/code&gt;, which includes assets required for the skybox.&lt;/p&gt;
&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Skyboxes &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, update the code to look like this:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added: Import skybox helpers&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start method as a callback&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application again. 🎮 You should now see a beautiful skybox surrounding the scene, making it look more immersive and realistic. 🌅 The &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/graphics/textures/skyboxes-and-backgrounds.html&quot;&gt;skybox&lt;/a&gt; is essentially a large, textured 3D model that wraps around the entire scene, providing a visually appealing background. 🌇&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Skybox added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-10.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-10.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add a skybox to the scene, enhancing the visuals and creating a more immersive environment. The skybox provides a realistic backdrop, adding depth and atmosphere to your scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot; tabindex=&quot;-1&quot;&gt;Step 11: Add Motion - I like to Move It, Move It! 🕺 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-11%3A-add-motion---i-like-to-move-it%2C-move-it!-%F0%9F%95%BA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before we dive into coding, let&#39;s take a moment to explore the different ways we can move entities in our scene. In Stride, we can move objects using two main approaches: &lt;strong&gt;non-physical movement&lt;/strong&gt; and &lt;strong&gt;physics-based movement&lt;/strong&gt;. Each method has its strengths and use cases, depending on the type of game or simulation you&#39;re creating.&lt;/p&gt;
&lt;h3 id=&quot;moving-entities-by-changing-their-position-directly-(without-colliders)&quot; tabindex=&quot;-1&quot;&gt;Moving Entities by Changing Their Position Directly (Without Colliders) &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-entities-by-changing-their-position-directly-(without-colliders)&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This method involves directly modifying an entity&#39;s position in the scene by changing its &lt;code&gt;Transform.Position&lt;/code&gt;. It&#39;s a straightforward approach that allows you to move objects freely without considering the physics of the environment. Here are some key points to keep in mind:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simple Movement:&lt;/strong&gt; This method is ideal for scenarios where you want to move objects in a controlled manner without requiring interaction with other entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical:&lt;/strong&gt; The entity doesn&#39;t respond to gravity, collisions, or any external forces. This makes it perfect for UI elements, floating objects, or objects that need to follow a predefined path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No Interaction:&lt;/strong&gt; By default, the entity won&#39;t collide with or interact with other objects in the scene. This can simplify certain game mechanics but also limits realism.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use cases for non-physical movement include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Camera Movement:&lt;/strong&gt; Moving a camera smoothly around the scene without it being affected by the environment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI Elements:&lt;/strong&gt; Moving user interface elements, like menus or health bars, without considering collisions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cutscenes or Animations:&lt;/strong&gt; Predefined animations where objects follow scripted paths.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;
You can still add custom code or use Stride&#39;s &lt;a href=&quot;https://doc.stride3d.net/latest/en/api/Stride.Core.Mathematics.CollisionHelper.html&quot;&gt;&lt;code&gt;CollisionHelper&lt;/code&gt;&lt;/a&gt; for basic interactions. For example, you can check for conditions like &lt;code&gt;BoxIntersectsBox&lt;/code&gt; or calculate distances between objects with &lt;code&gt;DistanceBoxBox&lt;/code&gt;.
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;moving-entities-using-physics-(with-colliders)&quot; tabindex=&quot;-1&quot;&gt;Moving Entities Using Physics (With Colliders) &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-entities-using-physics-(with-colliders)&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This approach leverages &lt;a href=&quot;https://doc.stride3d.net/latest/en/manual/physics-bullet/index.html&quot;&gt;Stride&#39;s Bullet physics engine&lt;/a&gt; to handle movement. By applying forces and impulses to an entity&#39;s &lt;code&gt;RigidbodyComponent&lt;/code&gt;, we can create realistic interactions that respond to gravity, collisions, and other physical phenomena. Key aspects of this approach include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Realistic Movement:&lt;/strong&gt; Entities move according to the laws of physics, making this method suitable for objects that need to interact with the environment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Collisions:&lt;/strong&gt; The entity will collide with other objects, allowing for dynamic interactions, such as objects bouncing off surfaces or pushing each other.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Forces:&lt;/strong&gt; Movement can be influenced by various forces, including gravity, wind, or explosions. This allows for more complex and dynamic gameplay mechanics.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Driven Gameplay:&lt;/strong&gt; This method is ideal for games that rely on physics-based mechanics, such as puzzle games, platformers, or simulations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use cases for physics-based movement include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Objects:&lt;/strong&gt; Moving objects that need to interact with other entities, like bouncing balls or rolling barrels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Character Movement:&lt;/strong&gt; Characters or vehicles that need to respond to the environment realistically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Environmental Interaction:&lt;/strong&gt; Objects that react to player actions, such as crates that can be pushed or destroyed.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned about the two main approaches to moving entities in Stride: non-physical movement and physics-based movement. Each method offers unique advantages, depending on whether you need simple control or realistic physics-driven interactions in your game or simulation.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot; tabindex=&quot;-1&quot;&gt;Step 12: Add Motion without Physics - Move the Cube without Colliders 📦 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-12%3A-add-motion-without-physics---move-the-cube-without-colliders-%F0%9F%93%A6&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s add a a cube 📦 to the scene! 🎉&lt;/p&gt;
&lt;p&gt;We&#39;ll start with the first option: moving the cube by directly changing its position. Update the code to look like this or replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for non-physical movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This is crucial for frame-independent movement, ensuring consistent&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// behaviour regardless of frame rate.&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;token comment&quot;&gt;// Move the cube along the negative X-axis with frame-independent motion&lt;/span&gt;
        cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;movementSpeed&lt;/code&gt; determines how fast the cube moves.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube1&lt;/code&gt; is an &lt;code&gt;Entity&lt;/code&gt; object representing the cube in the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Run(start: Start, update: Update)&lt;/code&gt; now includes the &lt;code&gt;Update&lt;/code&gt; method as a callback for updating the game state every frame.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddGroundGizmo()&lt;/code&gt; adds a visual representation of the ground plane and axis directions. Just a visual aid, it doesn&#39;t affect the physics of the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CreateMaterial()&lt;/code&gt; allows you to color the cube (and even the capsule if you want 😉).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Update()&lt;/code&gt; is a callback method that is called every frame to update the game state.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. 🏃 You should see a box (cube) moving along the X-axis, without interacting with other entities.&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-12.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-12.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to move a cube without using colliders, applying non-physical movement. The cube moves smoothly along the X-axis, showcasing basic object manipulation and animation.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot; tabindex=&quot;-1&quot;&gt;Step 13: Add Motion with Physics - Move the Cube with Colliders! 🧊 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-13%3A-add-motion-with-physics---move-the-cube-with-colliders!-%F0%9F%A7%8A&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now that we&#39;ve moved the cube without colliders, let&#39;s dive into the more realistic option: moving the cube using physics. With this approach, the cube will interact with the environment, responding to forces like gravity and colliding with other entities.&lt;/p&gt;
&lt;p&gt;Update the code to include physics-based movement or replace the entire file:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Physics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Create an instance of the game&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Start method to set up the scene&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Add the default graphics compositor to handle rendering&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D camera and a controller for basic camera movement&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a directional light to illuminate the scene&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a 3D ground plane to catch the capsule&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a performance profiler to monitor FPS and other metrics&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a skybox to enhance the scene&#39;s visuals&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a ground gizmo to visualize axis directions&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a 3D primitive capsule and store it in an entity&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Reposition the capsule 8 units above the origin in the scene&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add the entity to the root scene so it becomes part of the scene graph&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Create a cube with material, disable its collider, and add it to the scene&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// The cube is hanging in the default position Vector(0,0,0) in the air,&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// well intersecting the ground plane as it is not aware of the ground&lt;/span&gt;
    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Create a second cube with a collider for physics-based interaction&lt;/span&gt;
    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;token comment&quot;&gt;// Reposition the cube above the ground&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis (non-physical movement)&lt;/span&gt;
        cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the RigidbodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check if cube2 is stationary by verifying if its linear velocity is effectively zero.&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Math&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Round&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;LinearVelocity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to cube2 along the X-axis, initiating movement.&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// Reverse the direction of the impulse for the next impulse,&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// allowing cube2 to move back and forth along the X-axis.&lt;/span&gt;
            force &lt;span class=&quot;token operator&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Stride.Physics&lt;/code&gt; provides access to physics-related classes and components, including the &lt;code&gt;RigidbodyComponent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;force&lt;/code&gt; determines the strength of the impulse applied to the cube.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube2&lt;/code&gt; is an &lt;code&gt;Entity&lt;/code&gt; object representing the cube that will move using physics-based interactions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RigidbodyComponent&lt;/code&gt; handles physics interactions, allowing the entity to respond to forces, gravity, and collisions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;LinearVelocity&lt;/code&gt; represents the velocity of the cube. We check if the velocity is near zero (indicating the cube is stationary) before applying the impulse.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ApplyImpulse()&lt;/code&gt; applies a force to the entity, causing it to move in the direction of the applied force. In this case, we’re applying an impulse to the cube, making it move along the X-axis.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. 🏃‍♂️ You should now see two cubes in the scene:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cube 1&lt;/strong&gt; moves along the X-axis using non-physical movement, just like in the previous step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cube 2&lt;/strong&gt; interacts with the environment using physics, responding to forces and collisions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This step introduces a new level of realism by making the cube react to physical forces, adding depth and complexity to your game. 🎮&lt;/p&gt;
&lt;p&gt;The main difference between the two cubes is that &lt;strong&gt;Cube 1&lt;/strong&gt; moves without interacting with the environment. We directly modify the entity&#39;s &lt;code&gt;Transform.Position&lt;/code&gt; to move it, resulting in simple, non-physical movement. In contrast, &lt;strong&gt;Cube 2&lt;/strong&gt; responds to physics, collisions, and forces. Instead of manually changing its position, we control its movement through the &lt;code&gt;RigidbodyComponent&lt;/code&gt;, which handles all the physics-based interactions, including gravity, impulses, and collisions with other objects in the scene. This makes Cube 2&#39;s movement more realistic and reactive to its surroundings.&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-13.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-13.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to move a cube using physics-based movement, allowing it to interact with the environment. The cube responds to forces, gravity, and collisions, creating a more dynamic and realistic scene. You now understand the key differences between non-physical and physics-based movement, giving you greater control over how objects interact in your game world.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 14: Add Keyboard Interaction - Move the Cube! ⌨️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-14%3A-add-keyboard-interaction---move-the-cube!-%E2%8C%A8%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now it&#39;s time to add some interactivity! 🎮 We will update the &lt;code&gt;Update()&lt;/code&gt; method to allow the player to move the cubes around using the keyboard. We&#39;ll make sure both &lt;strong&gt;Cube 1&lt;/strong&gt; (non-physical movement) and &lt;strong&gt;Cube 2&lt;/strong&gt; (physics-based movement) respond to key presses.&lt;/p&gt;
&lt;p&gt;Ensure that the &lt;code&gt;using Stride.Input;&lt;/code&gt; namespace is included to handle input.&lt;/p&gt;
&lt;p&gt;You can replace the existing &lt;code&gt;Update&lt;/code&gt; method with the following code:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the negative X-axis when the Z key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the positive X-axis when the X key is held down&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Retrieve the RigidbodyComponent, which handles physics interactions&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// We use KeyPressed instead of KeyDown to apply impulses only once per key press.&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// This means the player needs to press and release the key to apply an impulse,&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// preventing multiple impulses from being applied while the key is held down.&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the left when the C key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Apply an impulse to the right when the V key is pressed (and released)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;game.Input.IsKeyDown()&lt;/code&gt; checks if a key is currently held down. This is useful for continuous actions, like moving an object as long as the key is pressed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Input.IsKeyPressed()&lt;/code&gt; checks if a key was pressed and released once. This is ideal for triggering actions that should only occur once per key press, such as applying an impulse to a physics object, to avoid multiple impulses being applied while the key is held down.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Additional Points:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The non-physical movement for &lt;strong&gt;Cube 1&lt;/strong&gt; allows smooth, continuous movement along the X-axis when holding the Z or X keys.&lt;/li&gt;
&lt;li&gt;The physics-based movement for &lt;strong&gt;Cube 2&lt;/strong&gt; applies an impulse to the cube when the C or V keys are pressed, allowing it to interact with the environment.&lt;/li&gt;
&lt;li&gt;The capsule does not collide with &lt;strong&gt;Cube 1&lt;/strong&gt; because we disabled the collider for that cube but interacts with &lt;strong&gt;Cube 2&lt;/strong&gt;, which has a collider and responds to physics.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the application. You should now be able to control &lt;strong&gt;Cube 1&lt;/strong&gt;&#39;s position with the Z and X keys, moving it left and right, and apply impulses to &lt;strong&gt;Cube 2&lt;/strong&gt; with the C and V keys, pushing it back and forth and colliding with the capsule. 🎮&lt;/p&gt;
&lt;p&gt;This step introduces basic keyboard controls, adding interactivity to your scene and allowing the player to manipulate objects in real-time. Ready to add even more interaction? Let&#39;s move on to mouse controls next! 🖱️&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-14.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-14.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You learned how to add keyboard interaction to the scene, allowing players to move the cubes using the Z, X, C, and V keys. &lt;strong&gt;Cube 1&lt;/strong&gt; responds to continuous key presses for smooth, non-physical movement, while &lt;strong&gt;Cube 2&lt;/strong&gt; reacts to single key presses, applying impulses for physics-based movement. These controls enable dynamic interaction and real-time object manipulation within the scene.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;Step 15: Add Mouse Interaction - Do something! 🖱️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-15%3A-add-mouse-interaction---do-something!-%F0%9F%96%B1%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s add mouse interaction to the scene! 🐭 In this step, we&#39;ll update the &lt;code&gt;Update()&lt;/code&gt; method to allow players to interact with the cubes and the capsule using the mouse 🖱️. We&#39;ll make sure both &lt;strong&gt;Cube 1&lt;/strong&gt; (non-physical movement), &lt;strong&gt;Cube 2&lt;/strong&gt;, and the capsule (physics-based movement) respond to mouse input.&lt;/p&gt;
&lt;p&gt;The previous comments have been streamlined to keep the code clean and focused🧹. Also, make sure you can see your console output to see the results of the mouse interactions.&lt;/p&gt;
&lt;p&gt;You can replace the entire code with the following, or refer to the comments labelled &lt;code&gt;// This was added&lt;/code&gt; to see the specific changes.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Physics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;CameraComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the camera component&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Simulation&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the physics simulation&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added: Store the model component of Cube 1&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// These were added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Initialize camera, simulation, and model component for interactions&lt;/span&gt;
    camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SceneSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SceneInstance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;GetProcessor&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;PhysicsProcessor&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;Simulation&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Ensure camera and simulation are initialized before handling mouse input&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Handle mouse input for interactions&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RaycastMouse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Succeeded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;

                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;camera&lt;/code&gt; stores the camera component for raycasting and ray picking.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;simulation&lt;/code&gt; stores the physics simulation for handling interactions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cube1Component&lt;/code&gt; stores the model component of &lt;strong&gt;Cube 1&lt;/strong&gt; for detecting intersections with the mouse ray.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;camera.RaycastMouse()&lt;/code&gt; detects collisions with physics-based entities using raycasting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;camera.GetPickRay()&lt;/code&gt; checks for intersections with non-physical entities using ray picking.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, when you click the left mouse button, the application will respond with the following actions depending on where you click:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clicking Outside the Ground:&lt;/strong&gt; If you click anywhere in the scene that doesn&#39;t intersect with an object or the ground, it will print &amp;quot;No hit detected.&amp;quot; This indicates that the mouse ray didn&#39;t collide with any entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on Cube 1:&lt;/strong&gt; Since &lt;strong&gt;Cube 1&lt;/strong&gt; doesn&#39;t have a collider, two things will happen:
&lt;ul&gt;
&lt;li&gt;The raycast will pass through &lt;strong&gt;Cube 1&lt;/strong&gt; and hit the ground beneath it, printing &amp;quot;Hit: Ground.&amp;quot;&lt;/li&gt;
&lt;li&gt;Additionally, the ray-picking method will detect that &lt;strong&gt;Cube 1&lt;/strong&gt; was hit, and it will print &amp;quot;Cube 1 hit!&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on Cube 2:&lt;/strong&gt; &lt;strong&gt;Cube 2&lt;/strong&gt; has a collider, so the raycast will detect the collision and print &amp;quot;Hit: Entity.&amp;quot; An impulse will be applied to &lt;strong&gt;Cube 2&lt;/strong&gt;, causing it to move upward in response to the click.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on the Capsule:&lt;/strong&gt; Similar to &lt;strong&gt;Cube 2&lt;/strong&gt;, clicking on the capsule will print &amp;quot;Hit: Entity,&amp;quot; and an upward impulse will be applied, making the capsule move.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clicking on the Ground:&lt;/strong&gt; If you click directly on the ground, the raycast will detect it and print &amp;quot;Hit: Ground.&amp;quot; However, the ground will remain stationary because it has a &lt;code&gt;StaticColliderComponent&lt;/code&gt;, meaning it&#39;s a fixed object in the scene.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nice job! You’ve now implemented mouse interaction, which adds a whole new level of interactivity to the game. 🚀 You can now click on objects in the scene to trigger different actions, like moving cubes or capsules with physics or detecting hits on non-physical entities. This opens up endless possibilities for gameplay mechanics! 🎮 We rock! 🤘&lt;/p&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-15.jpg&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-15.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You&#39;ve learned how to add mouse interaction to the scene, allowing players to interact with objects using raycasting for physics-based entities and ray picking for non-physical ones. You can now click on objects to apply forces or detect hits, adding a new layer of interactivity to the game.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot; tabindex=&quot;-1&quot;&gt;Step 16: Add Output - Console or Screen! 📺 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-16%3A-add-output---console-or-screen!-%F0%9F%93%BA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this part, we’ll explore basic output options, both to the console and directly on the screen. You’ve already added simple text output using &lt;code&gt;Console.WriteLine()&lt;/code&gt; to display interactions when an entity is hit by the mouse raycast. Now, let&#39;s expand on this to better visualize interactions and provide feedback to the player.&lt;/p&gt;
&lt;h3 id=&quot;output-options&quot; tabindex=&quot;-1&quot;&gt;Output Options &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#output-options&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We have several options for displaying output:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Console Output:&lt;/strong&gt; Useful for debugging and logging information. This is great for developers to see real-time feedback and troubleshoot the game
&lt;ul&gt;
&lt;li&gt;We can use traditional &lt;code&gt;Console.WriteLine()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;We can also use Stride&#39;s &lt;code&gt;GlobalLogger.GetLogger()&lt;/code&gt;, or the &lt;code&gt;Log&lt;/code&gt; property when used from within a game script&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug Text Output:&lt;/strong&gt; Display text directly in the game window, which is useful for quick, in-game debugging&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI Elements:&lt;/strong&gt; Create UI elements like text labels or buttons to display information to the player within the game world.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;updating-the-console-output&quot; tabindex=&quot;-1&quot;&gt;Updating the Console Output &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#updating-the-console-output&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s update the &lt;code&gt;if (hitResult.Succeeded) {}&lt;/code&gt; block by adding two lines to include additional output options:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Succeeded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;

        rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run the application. You should see additional output in the console window when you click around, highlighted in green by &lt;code&gt;GlobalLogger&lt;/code&gt;. However, the text in the &lt;strong&gt;game window&lt;/strong&gt; may flash briefly, as it’s being overwritten every frame.&lt;/p&gt;
&lt;h3 id=&quot;moving-output-to-the-screen&quot; tabindex=&quot;-1&quot;&gt;Moving Output to the Screen &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#moving-output-to-the-screen&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To keep the text on the screen, move the &lt;code&gt;game.DebugTextSystem.Print()&lt;/code&gt; call to the beginning of the &lt;code&gt;Update()&lt;/code&gt; method:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This was moved&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RaycastMouse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Succeeded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;

                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, when you run the application, the text &lt;strong&gt;&amp;quot;Entities:&amp;quot;&lt;/strong&gt; should remain visible on the screen at position &lt;em&gt;(50, 50)&lt;/em&gt;. This gives us some basic screen output! 📺 But since this output is more suited for debugging, let’s explore adding more polished UI elements.&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Seeing a different number of entities than expected on the screen? Debug the &lt;code&gt;Update()&lt;/code&gt;  and find out why is that 😯.&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;adding-ui-elements&quot; tabindex=&quot;-1&quot;&gt;Adding UI Elements &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#adding-ui-elements&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s create a simple text block on the canvas to display information to the player.&lt;/p&gt;
&lt;p&gt;Replace your current code with this or refer to the comments labelled &lt;code&gt;// This was added&lt;/code&gt; to see the specific changes.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bullet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Compositing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Diagnostics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Graphics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Physics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Controls&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Panels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;CameraComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;Simulation&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token class-name&quot;&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token class-name&quot;&gt;SpriteFont&lt;span class=&quot;token punctuation&quot;&gt;?&lt;/span&gt;&lt;/span&gt; font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was added&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddCleanUIStage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// This was updated&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token named-parameter punctuation&quot;&gt;showAxisName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    cube1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// No collider for simple movement&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    cube2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    camera &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    simulation &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SceneSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;SceneInstance&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;GetProcessor&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;PhysicsProcessor&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;Simulation&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    cube1Component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;ModelComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// This below was added: Create and display a UI text block&lt;/span&gt;
    font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Load&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;SpriteFont&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;StrideDefaultFont&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; canvas &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Canvas&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Width &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Height &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        BackgroundColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;248&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;177&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;149&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        HorizontalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; HorizontalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        VerticalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VerticalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bottom&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Children&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;TextBlock&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello, Stride!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;White&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; font&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextSize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Margin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Thickness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; uiEntity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Entity&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;UIComponent&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;UIPage&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt; RootElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; canvas &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            RenderGroup &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; RenderGroup&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Group31
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    uiEntity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt; time&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Entities: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            cube1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube2 &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;camera &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation &lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;// Check for collisions with physics-based entities using raycasting&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RaycastMouse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Succeeded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token interpolation-string&quot;&gt;&lt;span class=&quot;token string&quot;&gt;$&quot;Hit: &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token expression language-csharp&quot;&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.cs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply impulse upward&lt;/span&gt;

                rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
        &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cube1Component&lt;span class=&quot;token punctuation&quot;&gt;?.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ref&lt;/span&gt; ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;font&lt;/code&gt; stores the &lt;code&gt;SpriteFont&lt;/code&gt; used for the UI text block.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AddCleanUIStage()&lt;/code&gt; adds a clean UI stage to the graphics compositor, allowing UI elements to be displayed on top of the 3D scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;game.Content.Load&amp;lt;SpriteFont&amp;gt;()&lt;/code&gt; loads the default font for the UI text block.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Canvas&lt;/code&gt; is a UI panel that acts as a container for UI elements.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TextBlock&lt;/code&gt; is a UI element that displays text on the screen.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UIComponent&lt;/code&gt; is a component that manages UI elements in the scene.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UIPage&lt;/code&gt; is a UI page that contains the root element of the UI hierarchy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RenderGroup.Group31&lt;/code&gt; specifies the rendering order of the UI element, ensuring it appears on top of other elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Save and run the application. You should now see the text &lt;strong&gt;&amp;quot;Hello, Stride!&amp;quot;&lt;/strong&gt; displayed at the bottom left corner of the screen. 📺&lt;/p&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;Make sure that you added &lt;code&gt;AddCleanUIStage()&lt;/code&gt; .&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Congratulations! 🎉 You&#39;ve successfully added output to the screen, using both simple debugging text and a more polished UI element. This visual feedback enhances the player experience by providing real-time information and interactions. 🚀&lt;/p&gt;
&lt;img alt=&quot;Stride Game Engine - Code Only Basic - Output added&quot; src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-16.jpg&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2024/stride-basics-step-16.jpg&quot; /&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You’ve learned how to add various types of output, from basic console logging to real-time in-game text feedback. Using debugging text and polished UI elements, you can enhance both the developer experience and the player experience, providing essential information and interactivity in your game.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot; tabindex=&quot;-1&quot;&gt;Step 17: Break 2 - Let&#39;s Reflect 😅 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-17%3A-break-2---let&#39;s-reflect-%F0%9F%98%85&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Time for a quick reflection on what we&#39;ve achieved in the last few steps. We&#39;ve significantly expanded our game&#39;s functionality and interactivity. Here&#39;s a recap:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Performance Monitoring:&lt;/strong&gt; We added a profiler to monitor key metrics like FPS, helping optimize performance for a smoother experience. You also learned how to toggle through profiler outputs to track different aspects of the game. 🚀&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Visuals:&lt;/strong&gt; By adding a skybox, we made the scene more immersive, creating a polished and professional look. 🎨&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Understanding Motion:&lt;/strong&gt; We explored the difference between non-physical and physics-based movement, learning how to decide which method to use based on game mechanics. 🧠&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Non-Physical Movement:&lt;/strong&gt; You learned how to move entities using &lt;code&gt;Transform.Position&lt;/code&gt; without interacting with other objects. This approach is great for UI elements or simple animations. 🚶‍♂️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Physics-Based Movement:&lt;/strong&gt; By applying forces to entities via &lt;code&gt;RigidbodyComponent&lt;/code&gt;, we introduced realistic interactions with gravity and collisions, adding depth to the gameplay. ⚙️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keyboard Controls:&lt;/strong&gt; We implemented basic keyboard inputs to move entities, adding interactivity and responsiveness to the game. 🎮&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mouse Controls:&lt;/strong&gt; We extended player interaction by integrating mouse clicks, allowing players to trigger actions like applying forces to entities. 🖱️&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Displaying Output:&lt;/strong&gt; Finally, we explored output options, from console logs to UI elements, enhancing player feedback and communication. 📊&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entities Count:&lt;/strong&gt; While debugging, you discovered that an entity can be added to the scene without necessarily having a visual representation. You also learned that the camera, light, game profiler, and skybox are all entities as well. 🤯&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot; tabindex=&quot;-1&quot;&gt;Step 18: Add More Primitives - Let&#39;s go crazy! 🤪 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#step-18%3A-add-more-primitives---let&#39;s-go-crazy!-%F0%9F%A4%AA&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Two boxes 📦🧊 and a capsule 💊? That&#39;s not enough fun! I didn&#39;t sign up for just that! Let&#39;s crank it up and add more shapes to the scene!&lt;/p&gt;
&lt;p&gt;To do this, add the following code inside the &lt;code&gt;Update()&lt;/code&gt; method, below the &lt;code&gt;if (cube2 != null) {}&lt;/code&gt; block:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Space&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Green&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Size &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;xRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;yRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;token named-parameter punctuation&quot;&gt;zRange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, run the application, zoom out the camera to view the entire ground, and press the &lt;strong&gt;Space&lt;/strong&gt; key. Watch as new cubes spawn, pushing your FPS to its limits! 🚀 You can still use the left mouse button to apply forces to the cubes and the capsule, but that’s getting a bit old, isn’t it? 🥱&lt;/p&gt;
&lt;p&gt;Let&#39;s spice things up with more mouse interaction, this time using the &lt;strong&gt;middle mouse button&lt;/strong&gt;. Firstly add this namespace &lt;code&gt;using Stride.CommunityToolkit.Helpers;&lt;/code&gt; and then add the following code inside the &lt;code&gt;Update()&lt;/code&gt; method, just below the line &lt;code&gt;if (camera == null || simulation == null || !game.Input.HasMouse) return;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Middle&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RaycastMouse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;simulation&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

     &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Succeeded&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
     &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitResult&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collider&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;RigidbodyComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

         &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rigidBody &lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
         &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
             &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

             rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
         &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
     &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The final code is also available on &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasicsBulletPhysics/Program.cs&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Run the application, and now, whenever you click the middle mouse button on an object, it will get a random impulse in a random direction. 🎲 How cool is that?&lt;/p&gt;
&lt;div class=&quot;alert alert-warning d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#warning&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;More cubes = more responsibility! Keep an eye on performance. Once cubes float too far away into the void, consider removing them from the scene to maintain performance. We will cover this in Part 2 of the series.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;div class=&quot;alert alert-success d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#success&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;You&#39;ve now learned how to create more primitives using keyboard input and apply random forces to objects with the middle mouse button - all in just around &lt;strong&gt;240&lt;/strong&gt; lines of code.&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot; tabindex=&quot;-1&quot;&gt;Wrapping Up: Your Journey Continues 🎯 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#wrapping-up%3A-your-journey-continues-%F0%9F%8E%AF&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Congratulations, explorer! 🎉 You&#39;ve navigated through another significant chapter in your game development journey. 🌍 In this part, you delved deeper into interactivity, mastering how to implement mouse and keyboard controls to make your game more dynamic and engaging.&lt;/p&gt;
&lt;h3 id=&quot;what-you&#39;ve-achieved&quot; tabindex=&quot;-1&quot;&gt;What You&#39;ve Achieved &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#what-you&#39;ve-achieved&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;By adding mouse interactions, you’ve empowered players to directly interact with objects in your scene using techniques like raycasting and ray picking. Combined with the keyboard controls you implemented earlier, your game now responds to player inputs, allowing for real-time movement, actions, and feedback. 🖱️⌨️&lt;/p&gt;
&lt;h3 id=&quot;the-power-of-interactivity&quot; tabindex=&quot;-1&quot;&gt;The Power of Interactivity &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#the-power-of-interactivity&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Interactivity is at the heart of game design. By giving players the ability to influence the game world, you create a more immersive and engaging experience. The skills you&#39;ve developed—handling inputs, moving objects, managing physics, and providing feedback—are foundational to building more complex and polished games. 🌟&lt;/p&gt;
&lt;p&gt;If you&#39;d like to explore the final code for this project, you can access it on &lt;a href=&quot;https://github.com/VaclavElias/stride-examples/blob/main/src/CommunityToolkit/CodeOnlyBasicsBulletPhysics/Program.cs&quot;&gt;GitHub&lt;/a&gt;. Feel free to check it out and experiment! 💻&lt;/p&gt;
&lt;h2 id=&quot;follow-up-articles-%F0%9F%9A%B6&quot; tabindex=&quot;-1&quot;&gt;Follow-Up Articles 🚶 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#follow-up-articles-%F0%9F%9A%B6&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the not-so-distant future, we will cover the following topics in Bepu Physics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stride Community Toolkit Preview - Code-Only Feature - Advanced:&lt;/strong&gt; Let&#39;s get creative and explore more advanced features to take your game to the next level. 🚀
&lt;ul&gt;
&lt;li&gt;Maximize the game window&lt;/li&gt;
&lt;li&gt;Setting the Game Window Title&lt;/li&gt;
&lt;li&gt;Hot reload&lt;/li&gt;
&lt;li&gt;Removing entities from the scene&lt;/li&gt;
&lt;li&gt;Entities vs Children vs Components&lt;/li&gt;
&lt;li&gt;Interaction with the UI and from the UI&lt;/li&gt;
&lt;li&gt;Transforming entities&lt;/li&gt;
&lt;li&gt;Advanced physics interactions&lt;/li&gt;
&lt;li&gt;Audio and sound effects&lt;/li&gt;
&lt;li&gt;Particle effects&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stride Community Toolkit Preview - Code-Only Feature - Refactoring:&lt;/strong&gt; Let&#39;s refactor the code to make it more modular, reusable, and maintainable. 🛠️
&lt;ul&gt;
&lt;li&gt;Or in other words, let’s clean up the mess we made! 😅&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;support-stride-engine-%F0%9F%8C%9F&quot; tabindex=&quot;-1&quot;&gt;Support Stride Engine 🌟 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Stride is an open-source project that thrives on community contributions and support. By using Stride, sharing your experiences, and contributing to the community, you help make the engine better for everyone. 🚀&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contribute:&lt;/strong&gt; Share your knowledge, &lt;a href=&quot;https://github.com/stride3d/stride&quot;&gt;contribute to the engine&lt;/a&gt;, or &lt;a href=&quot;https://github.com/stride3d/stride/issues&quot;&gt;report issues&lt;/a&gt; to help improve Stride for all developers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Join the Community:&lt;/strong&gt; Engage with fellow developers, ask questions, and showcase your projects on our &lt;a href=&quot;https://discord.gg/f6aerfE&quot;&gt;Discord&lt;/a&gt; server or in &lt;a href=&quot;https://github.com/stride3d/stride/discussions&quot;&gt;GitHub Discussions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sponsor:&lt;/strong&gt; Support the continued development of Stride by becoming a sponsor on our &lt;a href=&quot;https://opencollective.com/stride3d&quot;&gt;Open Collective&lt;/a&gt; page.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-light d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#light&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;This content was reviewed and enhanced with the assistance of ChatGPT.&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Stride Community Toolkit Preview - Code-Only Feature Basics in F#</title>
    <link href="https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/"/>
    <updated>2024-09-21T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/</id>
    <content xml:lang="en" type="html">&lt;p&gt;Discover how to use the Stride Community Toolkit&#39;s &lt;strong&gt;code-only&lt;/strong&gt; feature with F#, showcasing a powerful set of extensions and helpers specifically tailored for game development in the Stride engine. Learn the basics of integrating F# with Stride&#39;s game engine to create 3D scenes, handle input, and manage entities, all using functional programming techniques.&lt;/p&gt;
&lt;p&gt;Table of Contents:&lt;/p&gt;
&lt;div class=&quot;table-of-contents&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#prerequisites-%F0%9F%8F%A0&quot;&gt;Prerequisites 🏠&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#getting-started-%F0%9F%9A%80&quot;&gt;Getting Started 🚀&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#how-to-play-%E2%8C%A8%EF%B8%8F&quot;&gt;How to Play ⌨️&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;Support Stride Engine 🌟&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;h2 id=&quot;introduction&quot; tabindex=&quot;-1&quot;&gt;Introduction &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#introduction&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This article is a condensed version of the original tutorial aimed at C# developers. You can find the original article &lt;a href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-csharp-bepu-physics&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Though I’m not an F# developer, I wanted to demonstrate how easy it is to use the Stride Community Toolkit with F#. The code provided is a direct translation of the original C# implementation into F#.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites-%F0%9F%8F%A0&quot; tabindex=&quot;-1&quot;&gt;Prerequisites 🏠 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#prerequisites-%F0%9F%8F%A0&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To follow this tutorial, you should have a solid understanding of F# and .NET.&lt;/p&gt;
&lt;p&gt;These steps were tested on a fresh installation of Windows 11.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://aka.ms/vc14/vc_redist.x64.exe&quot;&gt;Microsoft Visual C++ v14 Redistributable (x64)&lt;/a&gt; (approximately 19MB) and restart your system if prompted.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href=&quot;https://dotnet.microsoft.com/en-us/download&quot;&gt;.NET 10 SDK x64&lt;/a&gt; (around 215MB).&lt;/li&gt;
&lt;li&gt;Install the IDE of your choice. I will be using &lt;a href=&quot;https://visualstudio.microsoft.com/downloads/&quot;&gt;Visual Studio 2026&lt;/a&gt; (the Community version is free), but you can also use:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;Visual Studio Code&lt;/a&gt; - Free&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.jetbrains.com/rider/download/#section=windows&quot;&gt;Rider&lt;/a&gt; - Free for non-commercial use&lt;/li&gt;
&lt;li&gt;Any other IDE that supports .NET development&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;getting-started-%F0%9F%9A%80&quot; tabindex=&quot;-1&quot;&gt;Getting Started 🚀 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#getting-started-%F0%9F%9A%80&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create a new F# Console App (.NET) project in your IDE.&lt;/li&gt;
&lt;li&gt;Add the Stride Community Toolkit NuGet packages to your project.&lt;pre class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Windows &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;
dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Skyboxes &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;
dotnet &lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt; package Stride.CommunityToolkit.Bepu &lt;span class=&quot;token parameter variable&quot;&gt;--prerelease&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Replace the contents of the &lt;code&gt;Program.fs&lt;/code&gt; file with the code below.&lt;/li&gt;
&lt;li&gt;Run the project and enjoy the scene!&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;how-to-play-%E2%8C%A8%EF%B8%8F&quot; tabindex=&quot;-1&quot;&gt;How to Play ⌨️ &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#how-to-play-%E2%8C%A8%EF%B8%8F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;Z&lt;/code&gt; and &lt;code&gt;X&lt;/code&gt; keys to move the first cube left and right.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;C&lt;/code&gt; and &lt;code&gt;V&lt;/code&gt; keys to apply an impulse to the second cube in the opposite directions.&lt;/li&gt;
&lt;li&gt;Press the &lt;code&gt;Space&lt;/code&gt; key to create a new cube. You can create multiple cubes this way.&lt;/li&gt;
&lt;li&gt;Click the middle mouse button to apply a random impulse to the cube under the cursor.&lt;/li&gt;
&lt;li&gt;Click the left mouse button to apply an upward impulse to the cube under the cursor.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-fsharp&quot;&gt;&lt;code class=&quot;language-fsharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bepu
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Skyboxes
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Compositing
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Games
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Helpers
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; System
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Diagnostics
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Graphics
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Panels
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Controls
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Rendering
&lt;span class=&quot;token keyword&quot;&gt;open&lt;/span&gt; Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BepuPhysics

&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;1.0f&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; force &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; cube1&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Entity&lt;/span&gt; option &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; None
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; cube2&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Entity&lt;/span&gt; option &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; None

&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CameraComponent&lt;/span&gt; option &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; None
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; simulation&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;BepuSimulation&lt;/span&gt; option &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; None
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; cube1Component&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ModelComponent&lt;/span&gt; option &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; None

&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; font&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SpriteFont&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; Start &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGraphicsCompositor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddCleanUIStage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DCameraController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddDirectionalLight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add3DGround&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddProfiler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddSkybox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; ignore
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddGroundGizmo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.1f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; showAxisName &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; scene

    &lt;span class=&quot;token comment&quot;&gt;// Create the first cube (no collider)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; primitive1 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Bepu3DPhysicsOptions&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Gold&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        IncludeCollider &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    primitive1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; scene
    cube1 &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; Some primitive1

    &lt;span class=&quot;token comment&quot;&gt;// Create the second cube (with collider)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; primitive2 &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Bepu3DPhysicsOptions&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Orange&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    primitive2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;5.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    primitive2&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; scene
    cube2 &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; Some primitive2

    &lt;span class=&quot;token comment&quot;&gt;// Initialize camera, simulation, and model component for interactions&lt;/span&gt;
    camera &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; Some &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetCamera&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    simulation &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; camera &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; Option&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;map &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;fun&lt;/span&gt; c &lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt; c&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetSimulation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    cube1Component &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; primitive1&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Get&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;ModelComponent&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&gt;&lt;/span&gt; Option&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ofObj

    &lt;span class=&quot;token comment&quot;&gt;// Create and display a UI text block&lt;/span&gt;
    font &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Load&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;SpriteFont&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;StrideDefaultFont&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; canvas &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Canvas&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        Width &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;300.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Height &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        BackgroundColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;byte &lt;span class=&quot;token number&quot;&gt;248&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; byte &lt;span class=&quot;token number&quot;&gt;177&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; byte &lt;span class=&quot;token number&quot;&gt;149&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; byte &lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        HorizontalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; HorizontalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        VerticalAlignment &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VerticalAlignment&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Bottom&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Add a text block to the canvas&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; textBlock &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;TextBlock&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;Hello, Stride!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextColor &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;White&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Font &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; font&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        TextSize &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;24.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        Margin &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Thickness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    canvas&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Children&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;textBlock&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; uiEntity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Entity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    uiEntity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;UIComponent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
        Page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;UIPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;RootElement &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; canvas&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
        RenderGroup &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; RenderGroup&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Group31&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    uiEntity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; scene

&lt;span class=&quot;token comment&quot;&gt;// Define the Update method, called every frame to update the game state&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; Update &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;scene&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;time&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;GameTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;DebugTextSystem&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;sprintf &lt;span class=&quot;token string&quot;&gt;&quot;Entities: %d&quot;&lt;/span&gt; scene&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entities&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Count&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Int2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Calculate the time elapsed since the last frame for consistent movement&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// This is crucial for frame-independent movement, ensuring consistent&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// behaviour regardless of frame rate.&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; deltaTime &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; float32 time&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Elapsed&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TotalSeconds

    &lt;span class=&quot;token comment&quot;&gt;// Handle non-physical movement for cube1&lt;/span&gt;
    &lt;span class=&quot;token comment&quot;&gt;// Move the first cube along the X-axis (non-physical movement)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;match&lt;/span&gt; cube1 &lt;span class=&quot;token keyword&quot;&gt;with&lt;/span&gt;
    &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; Some cube &lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position
        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; newPosition &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                &lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Y&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;elif&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                &lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;X &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; movementSpeed &lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt; deltaTime&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Y&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; position&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Z&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
                position
        cube&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; newPosition
    &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; None &lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Handle physics-based movement for cube2&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;match&lt;/span&gt; cube2 &lt;span class=&quot;token keyword&quot;&gt;with&lt;/span&gt;
    &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; Some cube &lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; cube&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Get&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;C&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;true&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;elif&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;V&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;true&lt;/span&gt;
            rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;force&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; None &lt;span class=&quot;token operator&quot;&gt;-&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsKeyDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Keys&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Space&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Create3DPrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Cube&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Bepu3DPhysicsOptions&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
            Material &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreateMaterial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Color&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Green&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
            Size &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;13f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; scene

    &lt;span class=&quot;token comment&quot;&gt;// Ensure camera and simulation are initialized before handling mouse input&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;IsNone &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; simulation&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;IsNone &lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;not&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;HasMouse &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonDown&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Middle&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; hitInfo &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Unchecked&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;defaultof&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;HitInfo&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; hitResult &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Get&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; VectorHelper&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;RandomVector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20.0f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20.0f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;20.0f&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                    rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;true&lt;/span&gt;
                    rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// Return after handling middle mouse input&lt;/span&gt;

        &lt;span class=&quot;token comment&quot;&gt;// Handle left mouse button input&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;IsMouseButtonPressed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;MouseButton&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Left&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;mutable&lt;/span&gt; hitInfo &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Unchecked&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;defaultof&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;HitInfo&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; hitResult &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Raycast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;100f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;hitInfo&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; hitResult &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; message &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; sprintf &lt;span class=&quot;token string&quot;&gt;&quot;Hit: %s&quot;&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Name
                Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                GlobalLogger&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetLogger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Program.fs&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;message&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

                &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; hitInfo&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Collidable&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Get&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;BodyComponent&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; rigidBody &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&gt;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                    &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; direction &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;3.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0.0f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;// Apply upward impulse&lt;/span&gt;
                    rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Awake &lt;span class=&quot;token operator&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;true&lt;/span&gt;
                    rigidBody&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ApplyImpulse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;direction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; Vector3&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Zero&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;
                Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;No hit detected.&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// Check for intersections with non-physical entities using ray picking&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; ray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; camera&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;GetPickRay&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Input&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;MousePosition&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; cube1Component&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;IsSome &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cube1Component&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;BoundingBox&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Intersects&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&lt;/span&gt;ray&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;then&lt;/span&gt;
                Console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;Cube 1 hit!&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;token annotation&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&amp;lt;&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;EntryPoint&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Start the game loop and provide the Start and Update methods as callbacks&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// This method initializes the game, begins running the game loop,&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// and starts processing events.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt; main argv &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;start &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Action&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;Scene&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Start&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; update &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; System&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Action&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;Scene&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; GameTime&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Update&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; style=&quot;display: none;&quot;&gt;
    &lt;symbol id=&quot;success&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;info&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;light&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;warning&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;danger&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
&lt;/svg&gt;
&lt;div class=&quot;alert alert-info d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#info&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;The video below was recorded for the C# version, but the result is the same for F#.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;video class=&quot;mb-2 img-fluid&quot; controls=&quot;&quot; loop=&quot;&quot; preload=&quot;none&quot; poster=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.webp&quot;&gt;&lt;source src=&quot;https://www.vaclavelias.com/assets/img/2024/stride-basics-step-18.mp4&quot; type=&quot;video/mp4&quot; /&gt;&lt;/video&gt;&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot; tabindex=&quot;-1&quot;&gt;Conclusion &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#conclusion&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this article, you learned how to use the Stride Community Toolkit&#39;s &lt;strong&gt;code-only&lt;/strong&gt; feature with F# for game development in the Stride engine. We explored the basics of integrating F# with Stride to create 3D scenes, handle input, and manage entities—all while leveraging functional programming techniques.&lt;/p&gt;
&lt;p&gt;If you&#39;d like to see the full project, you can access it on GitHub. Feel free to check it out and experiment! 💻:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/VaclavElias/stride-examples/tree/main/src/CommunityToolkit/CodeOnlyBasicsFSharp&quot;&gt;Bepu F# Physics version&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/VaclavElias/stride-examples/tree/main/src/CommunityToolkit/CodeOnlyBasicsBulletPhysicsFSharp&quot;&gt;Bullet F# Physics version&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/VaclavElias/stride-examples/tree/main/src/CommunityToolkit/CodeOnlyBasics&quot;&gt;Bepu C# Physics version&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/VaclavElias/stride-examples/tree/main/src/CommunityToolkit/CodeOnlyBasicsBulletPhysics&quot;&gt;Bullet C# Physics version&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;support-stride-engine-%F0%9F%8C%9F&quot; tabindex=&quot;-1&quot;&gt;Support Stride Engine 🌟 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/stride3d/stride-community-toolkit-code-only-basics-fsharp/#support-stride-engine-%F0%9F%8C%9F&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Stride is an open-source project that thrives on community contributions and support. By using Stride, sharing your experiences, and contributing to the community, you help improve the engine for everyone. 🚀&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contribute:&lt;/strong&gt; Share your knowledge, &lt;a href=&quot;https://github.com/stride3d/stride&quot;&gt;contribute to the engine&lt;/a&gt;, or &lt;a href=&quot;https://github.com/stride3d/stride/issues&quot;&gt;report issues&lt;/a&gt; to help enhance Stride for all developers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Join the Community:&lt;/strong&gt; Engage with fellow developers, ask questions, and showcase your projects on our &lt;a href=&quot;https://discord.gg/f6aerfE&quot;&gt;Discord&lt;/a&gt; server or in &lt;a href=&quot;https://github.com/stride3d/stride/discussions&quot;&gt;GitHub Discussions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sponsor:&lt;/strong&gt; Support the ongoing development of Stride by becoming a sponsor on our &lt;a href=&quot;https://opencollective.com/stride3d&quot;&gt;Open Collective&lt;/a&gt; page.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-light d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#light&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;This content was reviewed and enhanced with the assistance of ChatGPT.&lt;/div&gt;
&lt;/div&gt;</content>
  </entry>
  <entry>
    <title>How to reference remote C# code in 11ty</title>
    <link href="https://www.vaclavelias.com/dotnet/remote-csharp-code-reference-example/"/>
    <updated>2023-03-15T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/remote-csharp-code-reference-example/</id>
    <content xml:lang="en" type="html">&lt;p&gt;We write blog posts and we want to reference our GitHub project C# code or any code from our projects in 11ty. This is a great way to share and maintain code snippets with the community.&lt;/p&gt;
&lt;h2 id=&quot;11ty-and-remote-source-code&quot; tabindex=&quot;-1&quot;&gt;11ty and remote source code &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/remote-csharp-code-reference-example/#11ty-and-remote-source-code&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I am new to 11ty so I asked the 11ty community here at &lt;a href=&quot;https://github.com/11ty/eleventy/discussions/2862&quot;&gt;GitHub Discussions&lt;/a&gt; and &lt;a href=&quot;https://github.com/pdehaan&quot;&gt;@pehann&lt;/a&gt; helped me out.&lt;/p&gt;
&lt;p&gt;I have modified the original implementation for this post so it is more generic.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;eleventyConfig&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addAsyncShortcode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;remote_include&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;urlPath&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; sample &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;EleventyFetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;url&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token literal-property property&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;1d&quot;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; sample&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example remote C# code reference in markup.&lt;/p&gt;
&lt;pre class=&quot;language-liquid&quot;&gt;&lt;code class=&quot;language-liquid&quot;&gt;```csharp
&lt;span class=&quot;token liquid language-liquid&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;{%&lt;/span&gt; remote_include &lt;span class=&quot;token string&quot;&gt;&#39;https://raw.githubusercontent.com/stride3d/stride/master/samples/Tutorials/CSharpIntermediate/CSharpIntermediate/CSharpIntermediate.Game/01_UI-Basics/UIByEditor.cs&#39;&lt;/span&gt; &lt;span class=&quot;token delimiter punctuation&quot;&gt;%}&lt;/span&gt;&lt;/span&gt;
```&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Result:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ &amp;amp; https://stride3d.net)&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Graphics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Controls&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;UI&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;CSharpIntermediate&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Code&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;UIByEditor&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token type-list&quot;&gt;&lt;span class=&quot;token class-name&quot;&gt;StartupScript&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;SpriteFont&lt;/span&gt; Font&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;TextBlock&lt;/span&gt; textBlock&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;EditText&lt;/span&gt; editText&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;Start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// Retrieve the page property from the UI component&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; page &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;UIComponent&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Page&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// Retrieve UI elements by Type and name&lt;/span&gt;
            textBlock &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;RootElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;FindVisualChildOfType&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;TextBlock&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;MyTextBlock&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            editText &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;RootElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;FindVisualChildOfType&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;EditText&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;MyEditText&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// When the text changes, update the textblock&lt;/span&gt;
            editText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;TextChanged &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
                textBlock&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;My name is: &quot;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; editText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Text&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// When the button is clicked, we execute a method that clears the textbox&lt;/span&gt;
            &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; button &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; page&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;RootElement&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token generic-method&quot;&gt;&lt;span class=&quot;token function&quot;&gt;FindVisualChildOfType&lt;/span&gt;&lt;span class=&quot;token generic class-name&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;Button&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;MyButton&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
            button&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Click &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; ButtonClicked&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;token keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;token return-type class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ButtonClicked&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;object&lt;/span&gt;&lt;/span&gt; sender&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;RoutedEventArgs&lt;/span&gt; e&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;// Changing the text triggers the TextChanged event again&lt;/span&gt;
            editText&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;token comment&quot;&gt;// We also want to reset the text in the textblock&lt;/span&gt;
            textBlock&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;...&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Explore Stride&#39;s Minimal API: A Code-Only Approach</title>
    <link href="https://www.vaclavelias.com/stride3d/stride3d-minimal-api-code-only/"/>
    <updated>2022-05-13T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/stride3d/stride3d-minimal-api-code-only/</id>
    <content xml:lang="en" type="html">&lt;p&gt;With only &lt;strong&gt;12 lines of code&lt;/strong&gt;, you can kickstart your game development journey in Stride 3D using the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/index.html&quot;&gt;Stride Community Toolkit&lt;/a&gt;, as illustrated in the example below (plus some &lt;code&gt;usings&lt;/code&gt; at the top).&lt;/p&gt;
&lt;p&gt;This method is compatible with &lt;a href=&quot;https://www.stride3d.net/&quot;&gt;Stride&lt;/a&gt; version &lt;strong&gt;4.1&lt;/strong&gt; and later.&lt;/p&gt;
&lt;p&gt;Follow the steps outlined in the &lt;a href=&quot;https://stride3d.github.io/stride-community-toolkit/manual/code-only/create-project.html&quot;&gt;Stride Community Toolkit&lt;/a&gt; to get started.&lt;/p&gt;
&lt;p&gt;Check out the related &lt;a href=&quot;https://twitter.com/VasoElias/status/1525162302487543809&quot;&gt;tweet&lt;/a&gt; for more insights.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Extensions&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;CommunityToolkit&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;ProceduralModels&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Core&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Mathematics&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token namespace&quot;&gt;Stride&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Engine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; game &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Game&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token named-parameter punctuation&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Scene&lt;/span&gt; rootScene&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SetupBase3DScene&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token class-name&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;/span&gt; entity &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; game&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;CreatePrimitive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;PrimitiveModelType&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Capsule&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Transform&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Position &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token constructor-invocation class-name&quot;&gt;Vector3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    entity&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;Scene &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; rootScene&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Visual Studio Advance</title>
    <link href="https://www.vaclavelias.com/dotnet/visual-studio-advance/"/>
    <updated>2021-05-24T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/visual-studio-advance/</id>
    <content xml:lang="en" type="html">&lt;p&gt;This post is a &lt;strong&gt;quick reference&lt;/strong&gt; and should help you to familiarise quickly with the key and essential &lt;strong&gt;Visual Studio&lt;/strong&gt; (VS) functionality.&lt;/p&gt;
&lt;p&gt;The VS Integrated Development Environment (IDE) might look overwhelming in the beginning but there is no need to know everything. More you work with VS you will start discovering what you need and you will eventually understand the complexity of VS by passive learning.&lt;/p&gt;
&lt;p&gt;Initial notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You should already be familiar with any coding/development IDE&lt;/li&gt;
&lt;li&gt;This is not a tutorial, this is a quick reference on what is the most important or helpful to know when you start working with Visual Studio. Do check any available material to familiarise and learn if you don&#39;t understand this guide&lt;/li&gt;
&lt;li&gt;If you don&#39;t know certain terms just google them&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;content&quot; tabindex=&quot;-1&quot;&gt;Content &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#content&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#1.-solution-vs-project&quot;&gt;1. Solution vs Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#2.-solution-explorer&quot;&gt;2. Solution Explorer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#3.-live-sharing-your-code---collaborative-coding&quot;&gt;3. Sharing your Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#4.-default-configuration---appsettings.cs-%2F-appsettings.json&quot;&gt;4. Default Configuration - AppSettings.cs / appsettings.json&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#5.-manage-user-secrets&quot;&gt;5. Manage User Secrets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#6.-editorconfig&quot;&gt;6. editorconfig&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#q%26a&quot;&gt;Q&amp;amp;A&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;1.-solution-vs-project&quot; tabindex=&quot;-1&quot;&gt;1. Solution vs Project &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#1.-solution-vs-project&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Depends on your circumstances and your team workflow, you might find different (sometimes confusing) folder structure patterns.&lt;/p&gt;
&lt;p&gt;VS projects can be in different physical locations on your drive and your VS solution is referencing them wherever the projects are. You can also have multiple solutions *&lt;strong&gt;.sln&lt;/strong&gt; if you need to reference/view projects in different ways. Many projects will be grouped together in their parent folder.&lt;/p&gt;
&lt;p&gt;Your solution projects might be independent from each other or some of them might have dependencies. The circular dependencies are not allowed and it is an anti-pattern.&lt;/p&gt;
&lt;p&gt;There are many ways to organise your solution. If you work in a team or alone, consistency is important.&lt;/p&gt;
&lt;p&gt;See some basic folder structure examples:&lt;/p&gt;
&lt;h3 id=&quot;example-1---projects-in-one-repository---mono-repo&quot; tabindex=&quot;-1&quot;&gt;Example 1 - Projects in one repository - Mono-repo &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#example-1---projects-in-one-repository---mono-repo&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This example is showing independent projects with no project dependencies, which are grouped together in the &lt;strong&gt;api-bureau.sln&lt;/strong&gt; solution. The intention might be to extract a common library which will be used by all projects. All projects are in the same repository to simplify a workflow for the small team who needs to work across all projects.&lt;/p&gt;
&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;/api-bureau
/api-bureau/api-bureau.sln
/api-bureau/.gitignore

/api-bureau/src/ApiBureau.CloudCall.Api
/api-bureau/src/ApiBureau.Confluence.Api
/api-bureau/src/ApiBureau.SharePoint.Api

/api-bureau/test/ApiBureau.CloudCall.Api.UnitTests
/api-bureau/test/ApiBureau.Confluence.Api.UnitTests
/api-bureau/test/ApiBureau.SharePoint.Api.UnitTests
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;example-2---projects-in-multiple-repositories&quot; tabindex=&quot;-1&quot;&gt;Example 2 - Projects in multiple repositories &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#example-2---projects-in-multiple-repositories&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This example is showing projects, which are grouped together in the &lt;em&gt;ApiBureau.AllApis.sln&lt;/em&gt; solution. The only dependency is that &lt;em&gt;all-apis&lt;/em&gt; project is dependent on all other APIs. The teams working mostly independently prefer to have their repos separated.&lt;/p&gt;
&lt;p&gt;Note: Visual Studio 2022+ supports managing multiple repositories from one solution.&lt;/p&gt;
&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;/api-bureau
/api-bureau/all-apis/.gitignore
/api-bureau/all-apis/ApiBureau.AllApis.sln
/api-bureau/all-api/src/ApiBureau.AllApis.Console

/api-bureau/cloudcall-api/.gitignore
/api-bureau/cloudcall-api/ApiBureau.CloudCall.sln
/api-bureau/cloudcall-api/src/ApiBureau.CloudCall.Api
/api-bureau/cloudcall-api/test/ApiBureau.CloudCall.Api.UnitTests

/api-bureau/confluence-api/.gitignore
/api-bureau/confluence-api/ApiBureau.Confluence.sln
/api-bureau/confluence-api/src/ApiBureau.Confluence.Api
/api-bureau/confluence-api/test/ApiBureau.Confluence.Api.UnitTests

/api-bureau/sharepoint-api/.gitignore
/api-bureau/sharepoint-api/ApiBureau.SharePoint.sln
/api-bureau/sharepoint-api/src/ApiBureau.SharePoint.Api
/api-bureau/sharepoint-api/test/ApiBureau.SharePoint.Api.UnitTests
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;2.-solution-explorer&quot; tabindex=&quot;-1&quot;&gt;2. Solution Explorer &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#2.-solution-explorer&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By default your Solution Explorer is showing only the most relevant files. And some files e.g., *&lt;strong&gt;.cs&lt;/strong&gt; will automatically appear in your Solution Explorer when you copy a file to your project folder or create a new C# file.&lt;/p&gt;
&lt;p&gt;Some files e.g., &lt;em&gt;.gitignore&lt;/em&gt; are hidden in the Solution Explorer so they don&#39;t distract you. It is good to familiarise yourself with the project folders and files. You can toggle these files by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer Toolbar → Click Show All Files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Or you can see all files on your drive through File Explorer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer → Right click on Solution -&amp;gt; Open Folder in File Explorer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don&#39;t use Solution Explorer, you can collapse this window to a vertical bar on the side of your screen. This is helpful when you share a screen, to get more visibility of your code.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer → Click the Auto Hide &lt;strong&gt;pin icon&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To reverse, click the vertical bar, then Solution Explorer and then pin icon again.&lt;/p&gt;
&lt;p&gt;More &lt;a href=&quot;https://docs.microsoft.com/en-us/visualstudio/ide/use-solution-explorer?view=vs-2022&quot;&gt;Solution Explorer resources&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;3.-live-sharing-your-code---collaborative-coding&quot; tabindex=&quot;-1&quot;&gt;3. Live Sharing your Code - Collaborative Coding &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#3.-live-sharing-your-code---collaborative-coding&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You are becoming familiar with VS and one day you need a help with your code. Your colleague or friend doesn&#39;t have the project you are working on, maybe they don&#39;t have VS but they have Visual Studio Code. Now you can share your VS session with anyone. Your colleagues will see exactly what you see, or they can navigate independently without downloading your project.&lt;/p&gt;
&lt;p&gt;Live Share lets you collaboratively explore, edit and debug with others in real time, regardless of what programming languages you&#39;re using or app types you&#39;re building.&lt;/p&gt;
&lt;p&gt;Read more about &lt;a href=&quot;https://docs.microsoft.com/en-us/visualstudio/liveshare/quickstart/share&quot;&gt;Live Sharing&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;4.-default-configuration---appsettings.cs-%2F-appsettings.json&quot; tabindex=&quot;-1&quot;&gt;4. Default Configuration - AppSettings.cs / appsettings.json &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#4.-default-configuration---appsettings.cs-%2F-appsettings.json&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Application configuration is a huge subject. If you are working with &lt;a href=&quot;http://asp.net/&quot;&gt;ASP.NET&lt;/a&gt; Core, get familiar with &lt;strong&gt;appsettings.json&lt;/strong&gt; and also with &lt;strong&gt;AppSettings.cs&lt;/strong&gt;. &lt;code&gt;IOptions&amp;lt;AppSettings&amp;gt;&lt;/code&gt; will let you use your configuration through strongly typed settings and dependency injection.&lt;/p&gt;
&lt;p&gt;.NET has lots of helpers and methods which will simplify access to your configuration and you can use them also outside of &lt;a href=&quot;http://asp.net/&quot;&gt;ASP.NET&lt;/a&gt; Core applications, e.g., Console Application.&lt;/p&gt;
&lt;p&gt;Very important is the sequence of configuration providers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;appsettings.json&lt;/li&gt;
&lt;li&gt;appsettings.{Environment}.json&lt;/li&gt;
&lt;li&gt;User secrets&lt;/li&gt;
&lt;li&gt;Environment variables&lt;/li&gt;
&lt;li&gt;Command-line arguments&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Lots of reading on this subject here &lt;a href=&quot;https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-6.0&quot;&gt;Application Configuration&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;5.-manage-user-secrets&quot; tabindex=&quot;-1&quot;&gt;5. Manage User Secrets &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#5.-manage-user-secrets&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Any passwords, secrets, any information you don&#39;t want to share has to be secured and not committed to your source control system like &lt;strong&gt;Git&lt;/strong&gt;. How do you do it in VS? Very easily.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer → Select your project → Right Click → Select Manage User Secrets
&lt;ul&gt;
&lt;li&gt;VS might ask to install this NuGet &lt;code&gt;Microsoft.Extensions.Configuration.UserSecrets&lt;/code&gt; or it will open file &lt;code&gt;secrets.json&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can use also .NET CLI to manage this file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;File &lt;code&gt;secrets.json&lt;/code&gt; is kept outside of your VS projects and solution and it is never pushed to your git repository. Note, that this file &lt;strong&gt;is not encrypted&lt;/strong&gt;. It is a plain text file, still hanging on your computer in this location:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;%APPDATA%&#92;Microsoft&#92;UserSecrets&#92;&amp;lt;user_secrets_id&amp;gt;&#92;secrets.json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Read more about &lt;a href=&quot;https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&amp;amp;tabs=linux&quot;&gt;Secrets in development&lt;/a&gt; subject.&lt;/p&gt;
&lt;h2 id=&quot;6.-editorconfig&quot; tabindex=&quot;-1&quot;&gt;6. editorconfig &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#6.-editorconfig&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you work alone or in a team, code consistency is very important in each project.&lt;/p&gt;
&lt;p&gt;You can add an EditorConfig file to your project or codebase to enforce consistent coding styles for everyone that works in the codebase. Do ask your colleagues and propose this process if it is not in place. Consistency helps with readability across all projects.&lt;/p&gt;
&lt;p&gt;More about this subject here &lt;a href=&quot;https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2022&quot;&gt;Settings with EditorConfig&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;q%26a&quot; tabindex=&quot;-1&quot;&gt;Q&amp;amp;A &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#q%26a&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;q%3A-how-to-change-the-.net-version%3F&quot; tabindex=&quot;-1&quot;&gt;Q: How to change the .NET version? &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-advance/#q%3A-how-to-change-the-.net-version%3F&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A1: Double click on the project file to open the project as XML and edit the &lt;code&gt;&amp;lt;TargetFramework&amp;gt;net5.0&amp;lt;/TargetFramework&amp;gt;&lt;/code&gt; tag. You can also target multiple frameworks by replacing this tag with &lt;code&gt;&amp;lt;TargetFrameworks&amp;gt;net5.0;net6.0&amp;lt;/TargetFrameworks&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Visual Studio Intro</title>
    <link href="https://www.vaclavelias.com/dotnet/visual-studio-intro/"/>
    <updated>2021-04-03T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/visual-studio-intro/</id>
    <content xml:lang="en" type="html">&lt;p&gt;This intro is a &lt;strong&gt;quick reference&lt;/strong&gt; and it should help you to familiarise quickly with the key and essential &lt;strong&gt;Visual Studio&lt;/strong&gt; (VS) functionality.&lt;/p&gt;
&lt;p&gt;The VS Integrated Development Environment (IDE) might look overwhelming in the beginning but there is no need to know everything. More you work with VS you will start discovering what you need and you will eventually understand the complexity of VS by passive learning.&lt;/p&gt;
&lt;p&gt;Initial notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You should already be familiar with any coding/development IDE&lt;/li&gt;
&lt;li&gt;This is not a tutorial, this is a quick reference on what is the most important or helpful to know when you start working with Visual Studio. Do check any available material to familiarise and learn if you don&#39;t understand this guide&lt;/li&gt;
&lt;li&gt;If you don&#39;t know certain terms just google them&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;content&quot; tabindex=&quot;-1&quot;&gt;Content &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#content&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#1.-solution-vs-project&quot;&gt;1. Solution vs Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#2.-opening-solution-%2F-project&quot;&gt;2. Opening Solution / Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#3.-solution-explorer&quot;&gt;3. Solution Explorer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#4.-windows-management&quot;&gt;4. Windows Management&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#5.-f12-is-your-friend---go-to-definition&quot;&gt;5. F12 is your friend - Go to Definition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#6.-ctrl%2Bt-and-ctrl%2Bq---search-everywhere&quot;&gt;6. CTRL+T and CTRL+Q - Search Everywhere&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#7.-dotnet-command&quot;&gt;7. dotnet command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#8.-project-story---viewing-csproj-in-summary&quot;&gt;8. Project story - Viewing csproj in summary&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#9.-project-packages-(nuget)&quot;&gt;9. Project Packages (nuget)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#10.-visual-studio-extensions&quot;&gt;10. Visual Studio Extensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#11.-visual-studio-settings&quot;&gt;11. Visual Studio Settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#q%26a&quot;&gt;Q&amp;amp;A&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;1.-solution-vs-project&quot; tabindex=&quot;-1&quot;&gt;1. Solution vs Project &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#1.-solution-vs-project&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Solution contains 1 or more projects to logically organise your projects together.&lt;/p&gt;
&lt;h2 id=&quot;2.-opening-solution-%2F-project&quot; tabindex=&quot;-1&quot;&gt;2. Opening Solution / Project &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#2.-opening-solution-%2F-project&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can open a project by clicking on a file with extension &lt;strong&gt;.sln&lt;/strong&gt; (solution) or &lt;strong&gt;.csproj&lt;/strong&gt; (C# project). If you open a project which is part of a solution, the solution might open instead automatically.&lt;/p&gt;
&lt;h2 id=&quot;3.-solution-explorer&quot; tabindex=&quot;-1&quot;&gt;3. Solution Explorer &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#3.-solution-explorer&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once you open your Solution or Project you want to see your &lt;strong&gt;Solution Explorer&lt;/strong&gt; which contains a logical hierarchy of all folders and files which are needed to build your project. You are going to use this window and navigate through it very frequently. Usually you would have your Solution Explorer on the right or on the left always visible.&lt;/p&gt;
&lt;p&gt;Note: If you cannot see it go to Menu → View → Click Solution Explorer (first in the menu)&lt;/p&gt;
&lt;h2 id=&quot;4.-windows-management&quot; tabindex=&quot;-1&quot;&gt;4. Windows Management &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#4.-windows-management&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You might use these options below frequently to arrange your windows. More info about &lt;a href=&quot;https://docs.microsoft.com/en-us/visualstudio/ide/customizing-window-layouts-in-visual-studio?view=vs-2022&quot;&gt;customising layouts&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Vertical Document Group - If you need to see different files next to each other &lt;img alt=&quot;Document Groups&quot; src=&quot;https://www.vaclavelias.com/assets/img/2021/Visual-Studio-Document-Group.webp&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2021/Visual-Studio-Document-Group.webp&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Horizontal Document Group - If you need to see different files horizontally&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Split Window - You can split horizontally the edition of a file through Window → Split. This is especially useful when visualizing or editing two locations in a large file &lt;img alt=&quot;Split Window&quot; src=&quot;https://www.vaclavelias.com/assets/img/2021/Visual-Studio-Horizontal-Split-Code-Editor.gif&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2021/Visual-Studio-Horizontal-Split-Code-Editor.gif&quot; /&gt;&lt;img alt=&quot;Split Window&quot; src=&quot;https://www.vaclavelias.com/assets/img/2021/Visual-Studio-Vertical-Split-Code-Editor.gif&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;/assets/img/2021/Visual-Studio-Vertical-Split-Code-Editor.gif&quot; /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New Window - Open an instance of the same file in a separate window, Window → New Window&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;5.-f12-is-your-friend---go-to-definition&quot; tabindex=&quot;-1&quot;&gt;5. F12 is your friend - Go to Definition &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#5.-f12-is-your-friend---go-to-definition&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Go To Definition&lt;/strong&gt; feature navigates to the source of a type or member, and opens the result in a new tab.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pressing F12 while your text cursor is somewhere inside the symbol name&lt;/li&gt;
&lt;li&gt;Right click mouse on the symbol → Go to Definition&lt;/li&gt;
&lt;li&gt;Or ALT+F12 to peek the identifier definition without opening a new tab&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;6.-ctrl%2Bt-and-ctrl%2Bq---search-everywhere&quot; tabindex=&quot;-1&quot;&gt;6. CTRL+T and CTRL+Q - Search Everywhere &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#6.-ctrl%2Bt-and-ctrl%2Bq---search-everywhere&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CTRL+Q - Search everywhere in the code, including menu items&lt;/li&gt;
&lt;li&gt;CTRL+T - Search everywhere in the code&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;7.-dotnet-command&quot; tabindex=&quot;-1&quot;&gt;7. dotnet command &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#7.-dotnet-command&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It provides commands for working with .NET projects
&lt;ul&gt;
&lt;li&gt;e.g. &lt;code&gt;dotnet build&lt;/code&gt; builds a project&lt;/li&gt;
&lt;li&gt;e.g. &lt;code&gt;dotnet --info&lt;/code&gt; shows detailed information about a .NET installation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It runs .NET applications
&lt;ul&gt;
&lt;li&gt;e.g. &lt;code&gt;dotnet myApplication.exe&lt;/code&gt; or &lt;code&gt;dotnet myApplication.dll&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;8.-project-story---viewing-csproj-in-summary&quot; tabindex=&quot;-1&quot;&gt;8. Project story - Viewing csproj in summary &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#8.-project-story---viewing-csproj-in-summary&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;.NET projects are based on the MSBuild format. Project files, which have extensions like &lt;strong&gt;.csproj&lt;/strong&gt; for C# project are in XML format. The csproj file includes settings related to targeted .NET Frameworks, project folders, NuGet package references etc.&lt;/p&gt;
&lt;p&gt;You can edit in 2 ways&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer → Select your project → Right Click → Select Edit Project File&lt;/li&gt;
&lt;li&gt;Solution Explorer → Double click on the project name&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;9.-project-packages-(nuget)&quot; tabindex=&quot;-1&quot;&gt;9. Project Packages (nuget) &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#9.-project-packages-(nuget)&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into &amp;quot;packages&amp;quot; that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages (source &lt;a href=&quot;https://docs.microsoft.com/en-us/nuget/what-is-nuget&quot;&gt;An introduction to Nuget&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is &lt;strong&gt;NuGet&lt;/strong&gt; (essentially a single ZIP file) with the &lt;strong&gt;.nupkg&lt;/strong&gt; extension.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Solution Explorer → Right click on Project→ Manage Nuget Packages
&lt;ul&gt;
&lt;li&gt;Browse - Search for new packages&lt;/li&gt;
&lt;li&gt;Installed - See your installed packages&lt;/li&gt;
&lt;li&gt;Updates - See current updates for your installed packages (mind minor vs major updates)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;10.-visual-studio-extensions&quot; tabindex=&quot;-1&quot;&gt;10. Visual Studio Extensions &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#10.-visual-studio-extensions&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Extensions allow you to customize and enhance your experience in Visual Studio by adding new features or integrating existing tools (Amazon, Azure, ..). The main purpose is to increase &lt;strong&gt;your productivity&lt;/strong&gt; and cater to your workflow.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Top Menu → Extensions → Manage Extensions
&lt;ul&gt;
&lt;li&gt;Installed - All installed and pre-installed extensions&lt;/li&gt;
&lt;li&gt;Online - Search for new extensions&lt;/li&gt;
&lt;li&gt;Updates - Update extensions, some extensions update automatically&lt;/li&gt;
&lt;li&gt;Roaming Extensions Manager - If you are logged into Visual Studio with your Microsoft account you can sync your extensions to other devices with Visual Studio&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Top free extensions for development
&lt;ul&gt;
&lt;li&gt;CodeMaid&lt;/li&gt;
&lt;li&gt;Productivity Power Tools 2019/2022 - Installs a few individual extensions for your productivity&lt;/li&gt;
&lt;li&gt;Live Share - Real-time collaborative development in Visual Studio and Visual Studio Code&lt;/li&gt;
&lt;li&gt;Web Essentials 2019/2022 -  Installs a few individual extensions for your web development&lt;/li&gt;
&lt;li&gt;AWS Toolkit - If you work/deploy to AWS&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;11.-visual-studio-settings&quot; tabindex=&quot;-1&quot;&gt;11. Visual Studio Settings &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#11.-visual-studio-settings&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Top Menu → Edit → Advance → Word Wrap
&lt;ul&gt;
&lt;li&gt;Very useful so you don&#39;t need to move your horizontal bar&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Top Menu → Tools→ Options → Projects and Solutions → Track Active Item in Solution Explorer -
&lt;ul&gt;
&lt;li&gt;Solution Explorer item is selected automatically when you edit the file in the Editor&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Top Menu → Tools→ Options → Productivity Power Tools (Extension) → Power Commands → Remove and Sort Using on save&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;q%26a&quot; tabindex=&quot;-1&quot;&gt;Q&amp;amp;A &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#q%26a&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id=&quot;q%3A-how-to-create-a-new-project-within-the-solution%3F&quot; tabindex=&quot;-1&quot;&gt;Q: How to create a new project within the solution? &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#q%3A-how-to-create-a-new-project-within-the-solution%3F&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A1: Solution Explorer → Right click on Solution → Add → New project or Existing Project&lt;/p&gt;
&lt;p&gt;A2: Top Menu → File → Add → New project or Existing Project&lt;/p&gt;
&lt;h3 id=&quot;q%3A-how-to-change-the-.net-version%3F&quot; tabindex=&quot;-1&quot;&gt;Q: How to change the .NET version? &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/visual-studio-intro/#q%3A-how-to-change-the-.net-version%3F&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A1: Double click on the project file to open the project as XML and edit the &lt;code&gt;&amp;lt;TargetFramework&amp;gt;net5.0&amp;lt;/TargetFramework&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;
&lt;p&gt;A2: Solution Explorer → Right Click on the Project → Click Properties → Click Application → Change Target Framework&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Jazor experiment</title>
    <link href="https://www.vaclavelias.com/dotnet/jazor-experiment/"/>
    <updated>2020-10-31T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/jazor-experiment/</id>
    <content xml:lang="en" type="html">&lt;p&gt;This experiment library helps with very common actions on the website which involve repeating JavaScript code across multiple different projects.&lt;/p&gt;
&lt;p&gt;Click a button or a link, do something in the backend and UI. This library takes an approach rather updating whole HTML blocks than granular tags with JSON and JavaScript libraries, so there is no need fiddling and mapping JSON objects to whatever UI you have.&lt;/p&gt;
&lt;p&gt;You might find this approach useful in certain project cases if you want to write minimum or no JavaScript. Still, JavaScript knowledge is required in certain scenarios.&lt;/p&gt;
&lt;p&gt;There is a crossover with &lt;a href=&quot;https://github.com/dotnet/blazor&quot;&gt;Blazor&lt;/a&gt; or rather Jazor is filling a gap between static HTML/Razor pages and Blazor.&lt;/p&gt;
&lt;p&gt;When could you possibly use this library and not necessarily Blazor?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You have got many Partial views in Razor pages and views which you would like to reuse e.g.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;token return-type class-name&quot;&gt;IActionResult&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;OnGetNews&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;  &lt;span class=&quot;token function&quot;&gt;Partial&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;_NewsPartial&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;You would like a hybrid of your current website and add simple SPA functionality&lt;/li&gt;
&lt;li&gt;Your project doesn&#39;t require minimising traffic in between the browser and server&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This library is using currently:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TypeScript to handle all common actions workload&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://asp.net/&quot;&gt;ASP.NET&lt;/a&gt; Core 5.0 TagHelpers to simplify using &lt;strong&gt;data-&lt;/strong&gt; and a bit help with strongly typed Controllers and Actions&lt;/li&gt;
&lt;li&gt;GitHub link &lt;a href=&quot;https://github.com/VaclavElias/Jazor&quot;&gt;https://github.com/VaclavElias/Jazor&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;requirements&quot; tabindex=&quot;-1&quot;&gt;Requirements &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/jazor-experiment/#requirements&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;jazor.js&lt;/code&gt; to your Razor page or _Layout.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;@addTagHelper *, Jazor&lt;/code&gt; to your _ViewImports.cshtml&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;todo&quot; tabindex=&quot;-1&quot;&gt;ToDo &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/jazor-experiment/#todo&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Add more functionality&lt;/li&gt;
&lt;li&gt;Make prompts and spinners pluggable&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;examples&quot; tabindex=&quot;-1&quot;&gt;Examples &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/jazor-experiment/#examples&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I will be using &lt;a href=&quot;https://getbootstrap.com/&quot;&gt;Bootstrap&lt;/a&gt; in my examples.&lt;/p&gt;
&lt;h3 id=&quot;example-1&quot; tabindex=&quot;-1&quot;&gt;Example 1 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/jazor-experiment/#example-1&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Load multiple delayed HTML / Partial Views.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Load News part&lt;/li&gt;
&lt;li&gt;Load Top News part after 1 second&lt;/li&gt;
&lt;li&gt;This will load your HTML from your desired url&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-url&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/examples/news&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Loading...&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-url&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;@((nameof(ExamplesController), nameof(ExamplesController.TopNews), null))&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-delay&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;1&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Loading...&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;example-2&quot; tabindex=&quot;-1&quot;&gt;Example 2 &lt;a class=&quot;direct-link&quot; href=&quot;https://www.vaclavelias.com/dotnet/jazor-experiment/#example-2&quot;&gt;🔗&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Click a button or link to load HTML / Partial Views to your target element.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-click&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/examples/itnews&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;button&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;btn btn-primary&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show .NET News&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;button&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-click&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;@((nameof(ExamplesController), nameof(ExamplesController.AngularNews), null))&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;jazor-target&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;button&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;btn btn-primary&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Show Angular News&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;The content will be loaded here.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  <entry>
    <title>Visual Studio Debugger Enumerable Visualizer</title>
    <link href="https://www.vaclavelias.com/dotnet/visual-studio-debugger-enumerable-visualizer/"/>
    <updated>2019-06-11T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/visual-studio-debugger-enumerable-visualizer/</id>
    <content xml:lang="en" type="html">&lt;p&gt;Visual Studio Debugger Enumerable Visualizer without any &lt;code&gt;[Serialize]&lt;/code&gt; attribute, using Json was an experiment to get a better experience when debugging IEnumerables.&lt;/p&gt;
&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; style=&quot;display: none;&quot;&gt;
    &lt;symbol id=&quot;success&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;info&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;light&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;warning&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
    &lt;symbol id=&quot;danger&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 16 16&quot;&gt;
        &lt;path d=&quot;M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z&quot;&gt;&lt;/path&gt;
    &lt;/symbol&gt;
&lt;/svg&gt;
&lt;div class=&quot;alert alert-warning d-flex&quot;&gt;
    &lt;svg class=&quot;bi flex-shrink-0 me-2 mt-1&quot; width=&quot;24&quot; height=&quot;24&quot; role=&quot;img&quot;&gt;&lt;use xlink:href=&quot;#warning&quot;&gt;&lt;/use&gt;&lt;/svg&gt;
    &lt;div&gt;This is now &lt;strong&gt;inbuilt&lt;/strong&gt; in &lt;a href=&quot;https://devblogs.microsoft.com/visualstudio/view-net-collections-with-the-new-ienumerable-debugger-visualizer/&quot;&gt;Visual Studio 2022&lt;/a&gt; from version 17.2.&lt;/div&gt;
&lt;/div&gt;
&lt;img alt=&quot;Visualiser example&quot; src=&quot;https://user-images.githubusercontent.com/4528464/59273012-2dc98f80-8c4f-11e9-8a76-c11620581a3e.png&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;https://user-images.githubusercontent.com/4528464/59273012-2dc98f80-8c4f-11e9-8a76-c11620581a3e.png&quot; /&gt;
&lt;img alt=&quot;Visualiser example&quot; src=&quot;https://user-images.githubusercontent.com/4528464/46559908-c0a87200-c8e9-11e8-83ba-deea211840f0.png&quot; class=&quot;img-fluid mb-2&quot; loading=&quot;lazy&quot; data-src=&quot;https://user-images.githubusercontent.com/4528464/46559908-c0a87200-c8e9-11e8-83ba-deea211840f0.png&quot; /&gt;
&lt;p&gt;Read more about my implementation here &lt;a href=&quot;https://github.com/codecapital/EnumerableVisualizer&quot;&gt;EnumerableVisualizer&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Configuration experiment in ASP.NET Core – RemoteJsonFile</title>
    <link href="https://www.vaclavelias.com/dotnet/configuration-experiment-aspnet.core-remote-json-file/"/>
    <updated>2019-06-01T00:00:00Z</updated>
    <id>https://www.vaclavelias.com/dotnet/configuration-experiment-aspnet.core-remote-json-file/</id>
    <content xml:lang="en" type="html">&lt;p&gt;This is an experiment project to access &lt;strong&gt;appsettings.json&lt;/strong&gt; from Azure Blob or any remote url.&lt;/p&gt;
&lt;p&gt;I will use public access to this Azure file considering no user secrets are included in this file. You would need to add additional options to secure your link if any user secrets are transmitted.&lt;/p&gt;
&lt;p&gt;Example url: &lt;a href=&quot;https://your-storage.blob.core.windows.net/your-blob/appsettings.json&quot;&gt;https://your-storage.blob.core.windows.net/your-blob/appsettings.json&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code class=&quot;language-csharp&quot;&gt;services&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AddRemoteJsonFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;Configuration&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;AppSettings:Url:RemoteUrl&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; options &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    Configuration &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; options&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Source here &lt;a href=&quot;https://github.com/codecapital/CodeCapital.AspNetCore/tree/net5.0/src/CodeCapital.AspNetCore.Extensions.Configuration.Json&quot;&gt;CodeCapital.AspNetCore.Extensions.Configuration.Json&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
</feed>