{"id":31963,"date":"2024-11-01T09:04:32","date_gmt":"2024-11-01T09:04:32","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=31963"},"modified":"2024-11-01T11:33:56","modified_gmt":"2024-11-01T11:33:56","slug":"unity-basic-course-applying-physics-effects","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/31963\/","title":{"rendered":"Unity Basic Course: Applying Physics Effects"},"content":{"rendered":"<p><body><\/p>\n<p>Hello! In this blog post, I will explain in detail how to apply and utilize physical actions in Unity. Unity is a powerful engine for game development, and its physics engine can add realism to events. Through physics-based simulation, you can finely control the movement, collisions, and reactions of objects. Let\u2019s get started!<\/p>\n<h2>1. Overview of Unity&#8217;s Physics Engine<\/h2>\n<p>Unity uses NVIDIA&#8217;s PhysX engine to handle physical calculations. This engine provides realistic physics simulations and supports many features that assist game developers in creating a sense of realism easily. The basic components of the physics engine are as follows:<\/p>\n<ul>\n<li><strong>Rigidbodies<\/strong>: Objects with physical properties that can be affected by gravity and forces.<\/li>\n<li><strong>Colliders<\/strong>: Serve as the boundary boxes for objects that can collide with each other. There are various shapes of colliders.<\/li>\n<li><strong>Forces<\/strong>: Control the movement of objects by applying different types of forces.<\/li>\n<\/ul>\n<h2>2. Understanding Rigidbodies<\/h2>\n<p>Rigidbodies are objects with physical properties, which enable them to respond to gravity or external forces. To use Rigidbodies, follow these steps:<\/p>\n<h3>2.1 Adding Rigidbodies<\/h3>\n<ol>\n<li>Select the object in the Unity editor.<\/li>\n<li>Click &#8220;Add Component&#8221; in the Inspector window.<\/li>\n<li>Select &#8220;Rigidbody&#8221; from the &#8220;Physics&#8221; category.<\/li>\n<\/ol>\n<p>Now the selected object will be affected by the physical effects of Rigidbodies!<\/p>\n<h3>2.2 Adjusting Rigidbodies Properties<\/h3>\n<p>You can experiment with various physical responses by adjusting the properties of Rigidbody. The main properties are as follows:<\/p>\n<ul>\n<li><strong>Mass<\/strong>: Sets the mass of the object. The larger the mass, the slower the response to forces.<\/li>\n<li><strong>Drag<\/strong>: Sets air resistance. As the value increases, it increases deceleration when moving at high speeds.<\/li>\n<li><strong>Angular Drag<\/strong>: Sets the resistance to rotational speed.<\/li>\n<li><strong>Use Gravity<\/strong>: If this option is enabled, the object will be affected by gravity.<\/li>\n<\/ul>\n<h2>3. Understanding Colliders<\/h2>\n<p>Colliders define the shape of an object&#8217;s boundary and serve to detect collisions. There are various shapes of Colliders, each designed for specific situations. The main Colliders are as follows:<\/p>\n<ul>\n<li><strong>Box Collider<\/strong>: A rectangular prism-shaped collider.<\/li>\n<li><strong>Sphere Collider<\/strong>: A sphere-shaped collider.<\/li>\n<li><strong>Capsule Collider<\/strong>: A capsule-shaped collider, suitable for characters.<\/li>\n<li><strong>Mesh Collider<\/strong>: A collider based on a custom mesh with a complex shape.<\/li>\n<\/ul>\n<h3>3.1 Adding Colliders<\/h3>\n<p>The process of adding a collider is similar to adding Rigidbodies. Select the required type of Collider and add it to the GameObject.<\/p>\n<h2>4. Forces and Object Movement<\/h2>\n<p>You can move objects using forces. There are various types of forces that allow you to manipulate objects in different ways. The main types of forces are as follows:<\/p>\n<ul>\n<li><strong>AddForce<\/strong>: Adds force to the object to move it.<\/li>\n<li><strong>AddTorque<\/strong>: Adds rotational force to the object to spin it.<\/li>\n<\/ul>\n<h3>4.1 AddForce Example<\/h3>\n<p>Let\u2019s look at a simple code example using AddForce:<\/p>\n<pre><code>using UnityEngine;\n\n    public class PlayerController : MonoBehaviour\n    {\n        public float speed = 10f;\n        private Rigidbody rb;\n\n        void Start()\n        {\n            rb = GetComponent<Rigidbody>();\n        }\n\n        void Update()\n        {\n            float moveHorizontal = Input.GetAxis(\"Horizontal\");\n            float moveVertical = Input.GetAxis(\"Vertical\");\n\n            Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);\n            rb.AddForce(movement * speed);\n        }\n    }<\/code><\/pre>\n<p>This code is an example where the object moves based on user input. The user can control the object using the arrow keys.<\/p>\n<h2>5. Collision Handling<\/h2>\n<p>Collision detection is an important element of physical simulations. Unity provides several methods to detect and respond to collisions.<\/p>\n<h3>5.1 OnCollisionEnter<\/h3>\n<p>This method is called when a collision occurs and is used to handle the object\u2019s collision. Here\u2019s an example of its usage:<\/p>\n<pre><code>void OnCollisionEnter(Collision collision)\n    {\n        if (collision.gameObject.tag == \"Obstacle\")\n        {\n            Debug.Log(\"Collision occurred!\");\n        }\n    }<\/code><\/pre>\n<p>This code logs a message when colliding with an object tagged &#8220;Obstacle&#8221;.<\/p>\n<h2>6. Experimenting with Physical Interactions<\/h2>\n<p>In real games, the physical properties we set can provide enjoyment. For example, observing objects fall or bounce can enhance immersion for the user. Here\u2019s a simple experiment example:<\/p>\n<h3>6.1 Creating a Floor and Placing Objects<\/h3>\n<p>To start, create a simple floor and a falling object:<\/p>\n<ol>\n<li>Add a Plane through the 3D Object menu in Unity to create the floor.<\/li>\n<li>Add a Sphere to create the falling object.<\/li>\n<li>Add a Rigidbody to the Sphere to make it affected by gravity.<\/li>\n<\/ol>\n<h3>6.2 Adjusting Object Reactions<\/h3>\n<p>Try adjusting the &#8220;Bounciness&#8221; property of the Rigidbody to experiment with how much the object bounces off the floor. You can observe various results by adjusting the object&#8217;s mass and the magnitude of the force.<\/p>\n<h2>7. Optimization and Content Creation<\/h2>\n<p>When using the physics engine, you must consider the performance of the game. Using too many Rigidbodies or Colliders can lead to performance degradation. Therefore, it&#8217;s necessary to disable physical actions on unnecessary objects or optimize using culling techniques.<\/p>\n<p>Additionally, physics simulations greatly contribute to creating engaging game content. You can plan enjoyable gameplay by leveraging the interactions of objects with various shapes colliding and reacting.<\/p>\n<h2>8. Conclusion<\/h2>\n<p>In this tutorial, we learned about understanding Rigidbodies and Colliders and how to apply forces using Unity&#8217;s physics engine. The physics engine is a crucial element in game development, providing users with a more realistic and engaging experience. By continuously experimenting and studying, I hope you become a better game developer.<\/p>\n<h3>9. Additional Resources<\/h3>\n<p>More information and resources can be found in the official Unity documentation and educational materials.<\/p>\n<p><a href=\"https:\/\/docs.unity3d.com\/Manual\/Physics.html\" target=\"_blank\" rel=\"noopener\">Official Unity Physics Engine Documentation<\/a><\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello! In this blog post, I will explain in detail how to apply and utilize physical actions in Unity. Unity is a powerful engine for game development, and its physics engine can add realism to events. Through physics-based simulation, you can finely control the movement, collisions, and reactions of objects. Let\u2019s get started! 1. Overview &hellip; <a href=\"https:\/\/atmokpo.com\/w\/31963\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Unity Basic Course: Applying Physics Effects&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[135],"tags":[],"class_list":["post-31963","post","type-post","status-publish","format-standard","hentry","category-unity-basic"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/31963\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Hello! In this blog post, I will explain in detail how to apply and utilize physical actions in Unity. Unity is a powerful engine for game development, and its physics engine can add realism to events. Through physics-based simulation, you can finely control the movement, collisions, and reactions of objects. Let\u2019s get started! 1. Overview &hellip; \ub354 \ubcf4\uae30 &quot;Unity Basic Course: Applying Physics Effects&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/31963\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:04:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:33:56+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Unity Basic Course: Applying Physics Effects\",\"datePublished\":\"2024-11-01T09:04:32+00:00\",\"dateModified\":\"2024-11-01T11:33:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/\"},\"wordCount\":792,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Unity Basic\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/\",\"url\":\"https:\/\/atmokpo.com\/w\/31963\/\",\"name\":\"Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:04:32+00:00\",\"dateModified\":\"2024-11-01T11:33:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/31963\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/31963\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity Basic Course: Applying Physics Effects\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/31963\/","og_locale":"ko_KR","og_type":"article","og_title":"Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Hello! In this blog post, I will explain in detail how to apply and utilize physical actions in Unity. Unity is a powerful engine for game development, and its physics engine can add realism to events. Through physics-based simulation, you can finely control the movement, collisions, and reactions of objects. Let\u2019s get started! 1. Overview &hellip; \ub354 \ubcf4\uae30 \"Unity Basic Course: Applying Physics Effects\"","og_url":"https:\/\/atmokpo.com\/w\/31963\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:04:32+00:00","article_modified_time":"2024-11-01T11:33:56+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/31963\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/31963\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Unity Basic Course: Applying Physics Effects","datePublished":"2024-11-01T09:04:32+00:00","dateModified":"2024-11-01T11:33:56+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/31963\/"},"wordCount":792,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Unity Basic"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/31963\/","url":"https:\/\/atmokpo.com\/w\/31963\/","name":"Unity Basic Course: Applying Physics Effects - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:04:32+00:00","dateModified":"2024-11-01T11:33:56+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/31963\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/31963\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/31963\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Unity Basic Course: Applying Physics Effects"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=31963"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31963\/revisions"}],"predecessor-version":[{"id":31964,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31963\/revisions\/31964"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=31963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=31963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=31963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}