Unity 2019 3D Game Physics
- 3 hours on-demand video
- 1 downloadable resource
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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)
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
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
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
- 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.
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.
- This video course will appeal to new game development hobbyists.