We may earn an affiliate commission when you visit our partners.
Ben Tristem

Learn to build your own game physics engine. By the end of this mini-course course you will have gained confidence in translating theories of physics into working game code.

I expect you to have some experience with both Unity 3D, and C# before starting this course. If you don't then check out my Complete Unity Developer course.

Why would you take this course?

  1. To understand game physics better.
  2. Practice creating your own physics components.
  3. Improve your knowledge of Newtons Laws of Motion.
Read more

Learn to build your own game physics engine. By the end of this mini-course course you will have gained confidence in translating theories of physics into working game code.

I expect you to have some experience with both Unity 3D, and C# before starting this course. If you don't then check out my Complete Unity Developer course.

Why would you take this course?

  1. To understand game physics better.
  2. Practice creating your own physics components.
  3. Improve your knowledge of Newtons Laws of Motion.

Note: We are no longer actively supporting this course, however if we do revisit this subject in the future then students on this course will get the updated content.

Access to this course does come with an optional, free community site where you can share games and 3D models, as well as connect with other students.

See you in there.

Enroll now

What's inside

Learning objectives

  • Translate new laws of physics to code.
  • Understand how game engine physics works.
  • Extend the capabilities of unity 3ds physics engine.
  • Transfer this knowledge to other game engines.

Syllabus

Determine if they are ready for the course, and if so setup their working environment.
Promo Video

IN THIS VIDEO...

What you'll need to start

  • A Mac or PC that can run Unity 3D or similar.
  • You can use another game engine if you like.
  • Some coding experience (see sample code).
  • Some understanding of mechanics & units.
  • Confidence in basic algebra.


Read more

IN THIS VIDEO...

  • An overview of the interface
  • How to search for things
  • Summary

IN THIS VIDEO...

  • Download, Install & Register Unity

SOME USEFUL LINKS...

  • Unity - Download Archive

(NOTE YOU CAN CLICK THESE LINKS BELOW)

Section Summary
Section End QUIZ
Create software components that model the effect of forces on point masses.

In this section we will be dealing with a rigid body, and the effect of forces on it.

  1. Unbalanced forces lead to accelerations.
  2. Accelerations lead to a change in velocity.
  3. Velocity determines the change in position.

We will be working backwards through this list, starting with position and eventually creating components to model the effect of various forces on our game object.

Section 2 Assets
Section Notes PDF

IN THIS VIDEO…

  • Introducing Sir Isaac Newton
  • Newton's First Law
  • About the FixedUpdate() loop
  • Updating transform.position

SOME USEFUL LINKS...

  • Using FixedUpdate() - Execution Order of Event Functions

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

Create A Force List

  • using System.Collections.Generic;
  • Create a public list of forces, forceVectorList;
  • Create AddForces () so sum the forces.
  • Debug.LogError () if we have a net force.
  • Otherwise continue to update the position.

IN THIS VIDEO...

  • 2nd Law Defined
  • Write Code For Acceleration
  • Publicly expose float mass
  • Create UpdateVelocity () method
  • Modify velocityVector every FixedUpdate
  • Remove Debug.LogError() code

IN THIS VIDEO...

  • Defining Newton's Third Law.
  • Examples of why it's important to consider.
  • Introducing our trail drawing code.
  • Switching trail direction.
  • Recap of Newton's laws

IN THIS VIDEO...

  • What we're trying to achieve.
  • Why it's important to get this “right”.
  • Re-orgainse list iteration for variable forces.
  • Bring DrawTrails.cs into PhysicsEngine.cs.
  • Move the forces into separate components.
Mid Section QUIZ
DOWNLOAD Unity Project

IN THIS VIDEO...

  • About Units and Dimensions.
  • Why it's worth thinking about them.
  • Where to annotate our units.
  • Prepare our RocketEngine.cs class.

SOME USEFUL LINKS...

  • SI base unit - Wikipedia, the free encyclopedia

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

  • The thrust of a rocket engine.
  • Modelling rocket engines and fuel burn.
  • An introduction to “delta V”.

SOME USEFUL LINKS...

  • Rocket engine - Wikipedia, the free encyclopedia

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

  • Review the universal gravitation equation*
  • Create a method for it in Unity.
  • Check we get realistic force values.

SOME USEFUL LINKS...

  • Gravitational constant

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

  • Setup a football field “on Earth”.
  • Test gravitation matches real values.
  • Explore parabolic flight.
  • Set scene for air resistance.

IN THIS VIDEO...

  • Design a simple formula for air resistance.
  • Create an Air Drag component.
  • Test flight against reference ball.
  • Tweak to get similar results to Unity's engine.

SOME USEFUL LINKS...

  • Drag (physics)

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

  • Expand on Unity's script execution order*
  • Demonstrate our bug at “high” speeds.
  • Show how this relates to fixed update time.
  • Move Universal Gravity to separate object.

SOME USEFUL LINKS...

  • Execution Order of Event Functions

(NOTE YOU CAN CLICK THESE LINKS BELOW)

IN THIS VIDEO...

  • Make a simple hit-the-target game.
  • Add a cylinder to represent a rocket launcher.
  • Write Launcher.cs class.

IN THIS VIDEO...

  • Re-introduce Universal Gravitation.
  • Review the overall structure of what we've done.

WHAT YOU'VE LEARNT...

  • Basic physics engine architecture / trade-offs.
  • A foundation in Newton's Laws of Motion.
  • Dimensional checking as a tool.
  • How to distill information from Wikipedia etc.
  • How to create components for various forces.
Calculate stable and unstable rotation on 3D spinning rigid bodies. Understand inertia tensors, torque, angular momentum, matrix multiplication, TRS matrices and more.
Introduction To Section 3
  • Section Assets Pack
  • Previous section project, for Magnus Effect
Section Notes
  • The limitations of spinning objects in Unity 5.
  • Why unstable rotation doesn't evolve.
  • How to model unstable rotation in game physics.
  • Roughly what is an inertia tensor (I)?
  • Unstable intermediate axis
  • How Unity Calculates I
  • Calculate I for your phone
  • Predict it's unstable axis
  • How about if two axis are equal?
  • Try it with a spinning cylinder.
  • Calculate the moment of inertia.
  • Render vs. collider mesh influence.
  • NOT the same as Intermediate Axis Theorem.
  • How to calculate I for compound objects.
  • Think of a discus thrower.

http://en.wikipedia.org/wiki/Parallel_axis_theorem

  • A recap of Newton's laws of motion.
  • How these relation to rotation.
  • Important differences.
  • Why we're jumping in the deep end!
  • How to use Unity's AddTorque() method.
  • How Inertia Tensor affects rotation.
  • Comparing the rotation of two objects.
  • What a cross product is.
  • Why they are so useful.
  • Using WolframAlpha to calculate.
  • What the Magnus Effect is.
  • How we can approximate ball flight with it.
  • Using Vector3.Cross in Unity.

The code you need is below...

public float magnusConstant = 1f;

private Rigidbody rigidBody;


void Start () {
rigidBody = GetComponent<Rigidbody> ();
}


// Update is called once per frame
void Update () {
rigidBody.AddForce (magnusConstant * Vector3.Cross (rigidBody.angularVelocity, rigidBody.velocity));
}

Section 3 Wrap-Up
How to use static friction, dynamic friction and bounciness in Unity 5.
Introduction To Section 4
Your Section 4 Assets
Your Section Notes
  • Why friction is so important.
  • About physics materials and friction.
  • How static and dynamic friction relate.
  • Using the Friction Direction 2 setting.
  • Limitations of Unity's friction, and to improve it.
  • Welcome “Mu-s”, the coefficient of static friction.
  • What the static friction coefficient means.
  • How this coefficient relates to slope angle.
  • Two triangle trigonometry take-home tricks.
  • Testing critical angle in Unity Editor.
  • Discover slipping angle.
  • Try three different static friction coefficients.
  • About rolling, and “impulsing” the block.
  • Generally horsing around with blocks and slopes.
  • Why we care about friction combine.
  • The limitations of Unity's model.
  • How friction combine precedence works.
  • What is dynamic friction.
  • How it relates to terminal velocity on a slope.
  • A look at some Stribeck curves.
  • What the Friction Direction 2 setting does.
  • How it might be useful.
  • A note on using unit vectors.
  • Friction Direction 2 doesn't work in Unity 5!

Congratulations and how to continue your learning.

Save this course

Save Game Physics - Introducing Gravitation & Rotation in Unity to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Game Physics - Introducing Gravitation & Rotation in Unity with these activities:
Review Newton's Laws of Motion
Reinforce your understanding of Newton's Laws of Motion, which are fundamental to understanding the physics engine concepts covered in this course.
Browse courses on Newton's Laws of Motion
Show steps
  • Read a summary of Newton's three laws.
  • Solve practice problems related to each law.
  • Relate each law to real-world examples.
Practice Vector Math Problems
Improve your proficiency with vector math, which is essential for working with forces, velocities, and rotations in game physics.
Show steps
  • Find a set of vector math problems online.
  • Solve the problems by hand.
  • Check your answers using a calculator or online tool.
Read 'Essential Mathematics for Games and Interactive Applications'
Solidify your understanding of the mathematical concepts underlying game physics, such as vectors, matrices, and transformations.
Show steps
  • Read the chapters on linear algebra and calculus.
  • Work through the examples and exercises.
  • Relate the mathematical concepts to the physics concepts covered in the course.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a Data Visualization of Projectile Motion
Visualize projectile motion with varying parameters to better understand the effects of gravity and air resistance.
Show steps
  • Write a script to simulate projectile motion.
  • Vary the initial velocity, angle, and air resistance.
  • Plot the trajectory of the projectile.
  • Create an interactive visualization that allows users to adjust the parameters.
Implement a Simple Gravity Simulation
Apply the concepts learned in the course by creating a basic gravity simulation in Unity, reinforcing your understanding of forces and motion.
Show steps
  • Create a new Unity project.
  • Create a script to apply a gravitational force to objects.
  • Adjust parameters to observe different gravitational effects.
  • Add collision detection and response.
Create a Video Explaining Inertia Tensors
Deepen your understanding of inertia tensors by creating a video that explains the concept in a clear and concise manner.
Show steps
  • Research inertia tensors and their properties.
  • Write a script for the video.
  • Record the video using screen recording software.
  • Edit the video and add annotations.
  • Share the video with others.
Read 'Game Physics Engine Development'
Expand your knowledge of game physics engine development by studying a book dedicated to the topic.
Show steps
  • Read the chapters on collision detection and rigid body dynamics.
  • Implement some of the algorithms described in the book.
  • Compare your implementation to the Unity physics engine.

Career center

Learners who complete Game Physics - Introducing Gravitation & Rotation in Unity will develop knowledge and skills that may be useful to these careers:
Physics Programmer
Physics Programmers specialize in simulating realistic physics within games and simulations. They create and optimize physics engines. This course will be very helpful, as it directly focuses on building your own game physics engine and translating physics theories into game code. Physics programmers also need to understand how game engine physics works, as well as extend the capabilities of existing physics engines. This course will lead to success as a physics programmer.
Game Developer
A Game Developer designs and codes the mechanics of a game. This can include character movement, object interactions, and, crucially, the physics of the game world. This course is centered around game physics and helps you gain confidence translating theories of physics into working game code. This will allow you to improve your understanding of game physics, practice creating your own physics components, and improve your knowledge of Newtons Laws of Motion, which are all crucial to the role of Game Developer.
Virtual Reality Developer
Virtual Reality Developers build immersive digital environments and experiences. Realistic physics simulations are essential for creating believable and engaging VR worlds. This course is centered around helping participants translate new laws of physics to code. This course helps you understand how game engine physics works and will assist you in extending the capabilities of Unity's physics engine. This will prepare you to become a Virtual Reality Developer.
Simulation Engineer
A Simulation Engineer develops software to model and simulate real-world physical systems. This role often requires a strong understanding of physics principles and the ability to translate them into code. This course may be useful, as it aims to help participants translate new laws of physics to code. This will help you understand how game engine physics works and extend the capabilities of Unity's physics engine. It will help you transfer this knowledge to other game engines as well.
Augmented Reality Developer
Augmented Reality Developers create applications that overlay computer-generated content onto the real world. Accurately simulating physics is crucial for creating realistic and immersive AR experiences. This course may be useful, as it helps to understand how game engine physics works. This will allow you to extend the capabilities of Unity's physics engine and transfer this knowledge to other game engines.
Robotics Engineer
Robotics Engineers design, build, and program robots. A strong grasp of physics is essential for creating robots that can interact with the physical world in a predictable and controlled way. This course may be useful by providing practical experience in applying physics principles within a simulated environment. You can learn to translate new laws of physics to code and understand how game engine physics works. You'll be ahead as a Robotics Engineer.
Artificial Intelligence Programmer
Artificial Intelligence Programmers create intelligent systems that can learn and adapt. When creating AI for games or simulations, it is often important to model realistic physical behaviors. This course may be useful for AI Programmers who need to incorporate physics into their AI systems. Also, the better a programmer understands physics, the better they can create AI to deal with it. Knowledge of game physics will help you transfer this knowledge to other game engines.
Research Scientist
Research Scientists conduct experiments and develop theories to advance scientific knowledge. A strong background in physics and mathematics is typically required, often including advanced degrees such as a Master's or PhD. This course may be useful for enhancing theoretical understanding of translating new laws of physics to code. This may also extend the capabilities of Unity's physics engine; thus, you can transfer this knowledge to other game engines.
Software Engineer
Software Engineers design, develop, and test software applications. While not always directly involved with physics, a Software Engineer can improve their coding skills and problem-solving abilities. This course may be useful by providing hands-on experience in translating theoretical concepts into practical code. You may also extend the capabilities of Unity's physics engine. As a result, you can transfer this knowledge to other game engines.
Teacher
Teachers at the high school or college level educate students in physics, mathematics, or computer science. This course may be useful for enhancing a teacher's understanding of physics concepts and providing engaging demonstrations for their students. Furthermore, you can improve your knowledge of Newtons Laws of Motion. This can help a teacher be a better educator and role model for students.
Mechanical Engineer
Mechanical Engineers research, design, develop, manufacture, and test mechanical devices and systems. A strong foundation in physics is essential for this role. This course may be useful, as it provides practical experience in applying physics principles within a simulated digital environment. Also, the better handle you have on physics, the better you will be as a Mechanical Engineer.
Data Scientist
A Data Scientist analyzes large datasets to identify trends and insights. In some cases, these datasets may involve physical systems or simulations. This course may be useful because it offers a unique perspective on translating theoretical models into code. You will be prepared to extend the capabilities of Unity's physics engine; therefore, you can transfer this knowledge to other game engines.
Aerospace Engineer
Aerospace Engineers design, develop, and test aircraft and spacecraft. A thorough understanding of physics, particularly mechanics and aerodynamics, is critical for this role. This course may be useful, as it offers a hands-on approach to simulating physical phenomena like gravity and air resistance. You may also extend the capabilities of Unity's physics engine, and then you can transfer this knowledge to other game engines.
Civil Engineer
Civil Engineers design, construct, and maintain infrastructure projects such as bridges, buildings, and roads. While this role doesn't always involve complex physics simulations, a solid understanding of mechanics and structural analysis is essential. This course may be useful by providing a practical way to visualize and interact with physical principles in a simulated environment. Since you will extend the capabilities of Unity's physics engine, you will be better prepared as a Civil Engineer.
Data Analyst
Data Analysts interpret data, analyze results using statistical techniques, and provide ongoing reports. While this role doesn't always involve complex physics simulations, a solid understanding of math is essential. This course may be useful by helping a Data Analyst to think in a practical way to translate theoretical concepts into practical code. you may also extend the capabilities of Unity's physics engine and then you can transfer this knowledge to other game engines.

Featured in The Course Notes

This course is mentioned in our blog, The Course Notes. Read one article that features Game Physics - Introducing Gravitation & Rotation in Unity:

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Game Physics - Introducing Gravitation & Rotation in Unity.
Provides a detailed guide to developing a game physics engine from scratch. It covers topics such as collision detection, rigid body dynamics, and constraint solving. It valuable resource for students who want to gain a deeper understanding of how game physics engines work. This book is best used as additional reading to expand on the course materials.
Provides a comprehensive overview of the mathematical concepts used in game development, including linear algebra, calculus, and physics. It is particularly useful for understanding the mathematical foundations of game physics engines. It serves as a valuable reference for students looking to deepen their understanding of the underlying mathematics. This book is commonly used by both students and industry professionals.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser