Unity 2019 3D Game Physics
3.8 (16 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
103 students enrolled

Unity 2019 3D Game Physics

Learn and apply 2D and 3D game physics with Unity 2019
3.8 (16 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
103 students enrolled
Created by Packt Publishing
Last updated 1/2020
English
English
Current price: $86.99 Original price: $124.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 3 hours on-demand video
  • 1 downloadable resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Get an in-depth understanding of the Unity physics system
  • Learn how and when to integrate physics in your game projects
  • Break down abstract game design mechanics into practical Unity physics solutions
  • Program C# for the most common and powerful physics tasks
  • Create a clone of the Angry Birds 2D game with collision detection and resolution
  • Create a clone of the Marble Madness 3D game driven by physics forces
  • Grasp key advanced topics and understand the future of Unity physics
Course content
Expand all 35 lectures 03:12:00
+ An Introduction to Game Physics for Unity 2019
5 lectures 24:31

What is Unity? Why add Unity physics to games? What is the objective of the course?

   •  Unity is a powerful interactive development platform

   •  Unity physics offers fun, realistic, and engaging game mechanics

   •  The expert instructor leads you to master the many facets of Unity physics

Preview 03:45

What are the major concerns of any physics system?

   •  Learn about its integration, learn how physics simulation fits into our game world

   •  Collision Detection detects which objects are overlapping

   •  Collision Resolution handles the realistic reaction (for example, bouncing) for each overlap

Integration, Collision Detection, and Collision Resolution
04:41

What are the unique features and benefits of Unity’s physics system?

   •  Unity is a powerful interactive development platform and offers great physics simulation

   •  Unity uses various third-party physics libraries with unique pros/cons

   •  Unity is vastly improving the physics systems with each update

Unity’s Physics System (Past, Present, and Future)
04:38

What are the Unity project settings and which values are most important for physics?

   •  Unity Project settings are high-level adjustments to the graphics, physics, and other details of the published player

   •  The gravity and default material are important settings

   •  2D Physics settings are separate from 3D, adjust as per what is appropriate for your project

Unity’s Physics Project Settings
05:57

What is the Unity physics lifecycle and how can we manipulate time?

   •  Physics is based on the MonoBehaviour lifecycle

   •  C# can hook into the relevant events

   •  For advanced timing needs, Physics.Simulate can be called manually

Physics Lifecycle, Physics.Simulate(), and Time Dilation
05:30
Test Your Knowledge
5 questions
+ Unity 2D Physics Components
5 lectures 24:08

What is the Rigidbody2D component and which of its properties are most important for us to use?

   •  The Rigidbody2D component enables physical behavior for a GameObject

   •  With a Rigidbody2D, the GameObject will immediately respond to gravity

   •  Body Type and Mass are among the most important Rigidbody2D properties

Preview 04:29

What is the Collider2D component and which of its properties are most important for us to use?

   •  The Collider2D component defines the shape of an object for the purposes of physical collisions

   •  Circle Collider2D and Box Collider2D are among the most popular types

   •  IsTrigger is an important property which determines if the collider is solid or not

The Collider2D Component
04:08

What are 2D Effectors and why are they useful?

   •  The 2D Effector component directs the forces of physics when colliders make contact

   •  2D Effectors give fine control over friction and other forces

   •  2D Effectors can be used for explosions, conveyor belts, platforms, and more

2D Effectors
05:39

What are 2D joints and why are they useful?

   •  The Joint2D component maintains a positional relationship with one or more GameObjects

   •  The HingeJoint2D is useful to create doors, bridges, and more

   •  2D joints are useful to mimic real-world objects or to add unique gameplay

2D Joints
05:44

What is unique about the Sprite Shape and how does it relate to physics?

   •  Sprite Shape gives the freedom to create rich free-form, organic 2D environments, straight in Unity

   •  The Sprite Shape is a preview feature in Beta and requires simple, additional installation

   •  Sprite Shapes generate appealing visuals, as well as, colliders for full physics simulation

Physics for Unity Sprite Shape (Preview Feature)
04:08
Test Your Knowledge
5 questions
+ Unity 3D Physics Components
5 lectures 26:08

How does Unity 3D physics compare to 2D physics and what is unique in 3D?

   •  The principles, components, naming, and C# code for 2D and 3D are similar, but not identical

   •  Both 2D and 3D support Rigidbody, collider, joints, and physics material concepts

   •  Only 2D has physics Effectors, whereas 3D has ragdoll physics

Preview 03:32

What is the physics material asset, how, and when do we use it?

   •  The physics material asset describes how to handle colliding objects (friction and bounciness)

   •  It is optional and may be added to the Rigidbody, in both 2D and 3D

   •  Use it when your game physics needs custom friction and bounciness

The Physics Material Asset
03:54

What are 3D joints and why are they useful?

   •  The 3D Joint component maintains a positional relationship with one or more GameObjects

   •  The HingeJoint3D is useful to create chains

   •  3D Joints are useful to mimic real-world objects or to add unique gameplay

3D Joints
06:34

What is Ragdoll physics and how do we use it?

  • Ragdoll physics is realistic physics movement of an unconscious humanoid character model

  • It is useful for showing the reaction to a character being killed or knocked unconscious

  • Use the Unity ragdoll wizard window to set up a new character model

Ragdoll Physics
07:18

What is Unity Terrain and how do we create Unity Terrain with physics support?

   •  The realistic physics interaction between the organic earth surface and other GameObjects is called Terrain physics

   •  Create a new Terrain through the Unity Menu: GameObject -> 3D Object -> Terrain

   •  Terrain physics is supported automatically via the Terrain Collider component

Terrain Physics
04:50
Test Your Knowledge
5 questions
+ Unity C# Physics Programming
6 lectures 34:44

What are the 3 OnCollision events, and why are they useful?

   •  OnCollisionEnter and OnCollisionExit happen at the start and end of the collision, whereas, OnCollisionStay repeats during the collision

   •  OnCollision events are useful to detect collisions between Rigidbodies

   •  The Collision.gameObject property can be checked to know what did one hit

OnCollision Events and the Collision Object
05:05

What are the 3 OnTrigger events, and why are they useful?

   •  OnTriggerEnter and OnTriggerExit happen at the start and end of the intersection, whereas, OnTriggerStay repeats during the intersection

   •  OnTrigger events are useful to detect intersections between colliders

   •  The Collider.gameObject property can be checked to know what did one hit

OnTrigger Events and the Collider Object
03:11

What is the difference between traditional movement and physics-based movement, and how are physics forces added?

   •  Traditional movement occurs on update with the transform component. Physics movement occurs during FixedUpdate with the Rigidbody component

   •  The most common way to add physics force is with the Rigidbody.AddForce () method

   •  Using the ForceMode of force is most common for gradual movement which respects mass

Adding Programmatic Forces
05:28

What are ways to manipulate physics properties and what are common use cases?

  • Many physics properties can be set in both the Unity Inspector and with C# code

  • A common use of isKinematic and useGravity is to toggle on and off physics for a specific GameObject

  • A common use of IsSleeping is to check if a GameObject has come to rest

isSleeping, isKinematic, useGravity, and Velocity
07:30

What are spatial queries and why are they useful in gaming?

   •  Spatial queries project a Ray (line) or a Collider (shape) through space to judge distances and potential future collisions

   •  A common use case for raycasting is to detect what could be in front of your GameObject

   •  A common use case of RaycastCommand is to run many raycast operations async and in parallel to improve game performance

Physics.Raycast() and RaycastCommand ScheduleBatch()
06:20

Why is physics debugging important and what are the tools available?

   •  Physics is highly complex and resource intensive, so optimization is important to improve game performance

   •  Debug.DrawRay() is useful to visualize certain operations in the editor and to quality-assure the project

   •  The Physics Debugger and Profiler window are useful to inspect the performance impact of physics solutions with an eye toward improvement

Physics Debugging: Debug.DrawRay(), Physics Debugger Window and Profiler Window
07:10
Test Your Knowledge
6 questions
+ Project: Creating an Angry Birds Clone 2D Game
5 lectures 31:58

How do we proceed from initial inspiration to planning a game project?

   •  First, use the inspiration for reference and pick the parts we want to use

   •  Next, breakdown the project into major tasks

   •  Lastly, we completely open Unity, and set up the project structure and scene hierarchy

2D Project Setup
07:13

How do we take user input and create projectile motion?

   •  First, use the mouse input from the user to aim

   •  Next, use Rigidbody.AddForce() to create projectile motion

   •  Lastly, isolate key gameplay variables for easy tweaking

Creating the Player and Input
07:07

How do we create a flexible system of various game obstacles?

   •  First, create a WorldItem concept with OnCollision events and health

   •  Next, send out damage events and use that to update graphics

   •  Lastly, tweak the resistance to damage to give a good difficulty level

Creating the Obstacles
06:53

How do we decide when the game end, for example, win and loss?

   •  First, decide the rules of the game

   •  Next, implement those rules in code using gaming paradigms like score and lives

   •  Lastly, create a UI (text/images) to communicate the rules and the result (win and loss)

Adding Win/Loss Conditions
06:11

What is polish and how do we add it to please the users?

   •  Polish is the input, animation, and graphics used to make a good game great

   •  Identify the aspects of our game that need polish

   •  Add easy-to-implement fades and tweens to please the eye

Adding Extra Polish
04:34
Test Your Knowledge
5 questions
+ Project: Creating a Marble Madness Clone 3D Game
5 lectures 24:33

How do we proceed from initial inspiration to planning a game project?

   •  First, use the inspiration for reference and pick the parts you want to use

   •  Next breakdown the project into major tasks

   •  Lastly, open Unity and set up the project structure and scene hierarchy

3D Project Setup
04:44

How do we take user input and create physics motion?

   •  First, use the keyboard input from the user

   •  Next, use Rigidbody.AddForce() to create physics motion

   •  Lastly, isolate key gameplay variables for easy tweaking

Creating the Player and Input
04:35

How do we create a flexible system of various game obstacles?

   •  First, plan for the types of objects in the world and decide on behavior

   •  Next, create movable and immovable objects

   •  Lastly, do the level design to create a fun and challenge

Creating the Obstacles
05:33

How do we decide when the game ends? for example (win and loss)

   •  First, decide on the rules of the game

   •  Next, implement those rules in code using gaming paradigms like score and time

   •  Lastly, create a UI (text/images) to communicate the rules and the result (win and loss)

Adding Win/Loss Conditions
04:16

What is polish and how do we add it to please the users?

   •  Polish is the input level design and input, used to make a good game great

   •  Identify aspects of our game that need polish

   •  Add easy-to-implement fades and tweens to please the eye

Adding Extra Polish
05:25
Test Your Knowledge
5 questions
+ Advanced Topics
4 lectures 25:58

What the, best practices for physics projects to help ease development and scale your projects?

   •  Use only 2D physics for 2D games and only 3D physics for 3D games

   •  Use physics as it was intended, including moving via physics forces

   •  Be aware of which operations are processor intensive and avoid them

Best Practices with Physics
04:37

How do you get the best performance in your physics projects?

   •  Use the latest version of Unity for the best performance

   •  Adjust physics settings like Time.fixedDeltaTime and Physics.sleepThreshold to optimize performance

   •  Use primitive colliders instead of mesh colliders for efficient runtime playback

Optimizing Physics
09:13

How can you predict the path of a Rigidbody?

   •  When prediction is needed, include it early in development, for best results

   •  Move your object with physics forces

   •  Use the separate UnityEngine.PhysicsScene to run the predictive calculations

Predicting Physics Trajectory
05:37

What is Unity DOTS and how will it impact the future of Unity physics?

   •  The Data-Oriented Technology Stack (DOTS) offers high performance by default

   •  DOTS features include the C# Job System, the (ECS) pattern for writing code, and the burst compiler for optimization

   •  The future of Unity Physics with DOTS represents blazing fast speed improvements

Data-Oriented Technology Stack (DOTS) for Unity Physics
06:31
Test Your Knowledge
4 questions
Requirements
  • Who want to leverage physics in their first projects, as well as to game development experts who want to add the power of physics to their skillset.
Description

Physics is really important for game programmers who want to add realism and functionality to their games. Collision detection, in particular, is a problem that affects all game developers, regardless of the platform, engine, or toolkit they use. This course will help you to understand game physics better. You will practice creating your own physics components and improve your knowledge of Newton's Laws of Motion and their applications to game development. This course will teach you the concepts and formulas behind collision detection. You will also be taught how to build a simple physics engine, where rigid body physics is the main focus, and learn about intersection algorithms for primitive shapes. You will be implementing 2D and 3D primitives, and we'll show you how to perform effective collision tests and cover one of the harder areas of game development—collision detection and resolution. Further on, you will learn what a physics engine is, how to set up a game window, and how to implement rendering. You’ll also find out how to implement a rudimentary physics engine, which you can use to build an "Angry Birds" type of game or a more advanced game. By the end of this course, you will have gained confidence in translating theories of physics into working game code. You will have implemented all primitive and some advanced collision tests, and you will be able to read on geometry and linear Algebra formulas to take forward to your own games!

About the Author

Samuel Asher Rivello is a Unity Certified Developer with 19 years of experience creating games and educational software. He loves games! He served on the founding team of “Neopets .com” and led the team of game developers through the company’s acquisition by Viacom/MTV. He created the custom, real-time multiplayer gaming framework for “MyYearbook .com” through its acquisition by Quepasa. He has shipped many Unity titles including “Shiftlings” published by the legendary Sierra Games for Xbox, PlayStation, and Steam and “Subway Surfers” created by SYBO Games for Android and iOS. He has taught at American universities including USC and UCLA and has presented at conferences, including Adobe Max, FITC, FlashForward, and LA Games Summit. He has served as author and editor for Adobe, Future Publishing UK, O’Reilly, and more. Sam’s mission is to educate and entertain with interactive technology and to champion best practices, coding standards, and learning. He now consults for top clients as a Unity Game Developer and Unity Tools Developer to “level-up” interactive projects in gaming, education, and AR/VR.

Who this course is for:
  • This video course will appeal to new game development hobbyists.