filmov
tv
The Ultimate Guide for Physics in Game Development!
Показать описание
In this video, I am going to thoroughly go over everything about physics in game development. Regardless of whether you are a complete beginner and don’t know what a force is, or a seasoned game developer who uses physics all the time, I can almost guarantee that you will take something new away from this video. This is the ultimate guide for physics in game development.
The video is broken up into 8 different sections and in each section, I first go over the core concept and then show you how it can actually be used. The sections are kinematics, Forces, Friction, Drag, Collisions, Impulsive Forces, Rotational kinematics and dynamics, and the Rigidbody Component.
In the video, I use the unity game engine (particularly unity 3D), but physics is physics and the concepts and themes will be the same regardless of the game engine you use.
Links:
Chapters:
0:00 - Intro
1:18 - Kinematics
9:44 - Forces
19:08 - Friction
27:14 - Drag
33:38 - Collisions
40:39 - Impulsive Forces
46:23 - Rotational Motion
56:11 - Rigidbody Component
1:02:13 - Recap
Kinematics is the branch of mechanics concerned with the motion of objects without reference to the forces which cause the motion. This basically means that we are calculating an object's motion from some initial set of conditions and the time elapsed. Here we are not going to consider any forces. In game development, we can incorporate this concept with the kinematic equations. The main kinematic equation and the only one you really need is xf = 0.5at2 + vt + xi. In Unity, we can make a script in C# that has a function with the kinematic equation coded in. This way we can set up some initial conditions and launch objects in our video games.
Kinematics is pretty good, but there are some drawbacks. The biggest one (at least for us game developers) is the fact that handling collisions with kinematics is very difficult because you would have to program it all yourself. It is a much better idea to let the unity game engine handle all of that stuff and you use forces.
A force is a just a mass times an acceleration, and they can be constantly applied to an object to accelerate it realistically. We can use forces in our games this way to simulate things that are constantly getting faster. The demo I used in the video was rockets accelerating forward in space. In Unity we can use forces by calling the AddForce function on our Rigidbody.
Friction is a type of force that resists the motion of two objects in contact and is the force responsible for making objects stop moving when no other force acts on them. The force of friction is equal to the coefficient of friction times the force normal. In unity we set this up by adjusting the two friction values in a physics material. the friction values on the two objects in contact get combined somehow to produce the coefficient of friction used in the actual calculation. If no physics material is on an object it will behave as is it has a static and dynamic friction of .6
Drag is another resistive force that resists the motion of an object as it is suspended in free fall. The force of drag (simplified version) is equal to -bv. In unity however the drag variable doesn't equal b, it equals b / m or g / vt where vt is terminal velocity.
There are 3 main types of collisions, elastic collisions, where no energy is lost, inelastic collisions, where some energy is lost, and perfectly inelastic collisions, where all energy is lost. No matter what type of collision you are facing, momentum is always conserved. We can determine a collisions elasticity in unity by using the bounciness variable in our physics materials.
Impulsive forces are a way for us to quickly change an objects momentum. We could realistically do this by having a very high force acting over a short time, or we could just do a cheeky game developer move and do it instantly. To do this in unity all you have to do is type ForceMode.Impulse as the second argument in the AddForce function. This is probably one of if not the most important topics in the video.
Rotational motion is broken up into two mini sections with the first being on rotational kinematics. It's exactly the same as regular kinematics except just using the rotational variables. The next mini section is on rotational dynamics mainly just focusing on torques. Torque is the measure of the force that causes an object to spin around an axis. It equals the position vector crossed with the force vector, and also an object's moment of inertia times its angular acceleration.
In the last section I just went over everything else about the Rigidbody component in Unity.
Discord: Will Hess(hashtag)9883
If you have any questions DM me over Instagram or Discord
The video is broken up into 8 different sections and in each section, I first go over the core concept and then show you how it can actually be used. The sections are kinematics, Forces, Friction, Drag, Collisions, Impulsive Forces, Rotational kinematics and dynamics, and the Rigidbody Component.
In the video, I use the unity game engine (particularly unity 3D), but physics is physics and the concepts and themes will be the same regardless of the game engine you use.
Links:
Chapters:
0:00 - Intro
1:18 - Kinematics
9:44 - Forces
19:08 - Friction
27:14 - Drag
33:38 - Collisions
40:39 - Impulsive Forces
46:23 - Rotational Motion
56:11 - Rigidbody Component
1:02:13 - Recap
Kinematics is the branch of mechanics concerned with the motion of objects without reference to the forces which cause the motion. This basically means that we are calculating an object's motion from some initial set of conditions and the time elapsed. Here we are not going to consider any forces. In game development, we can incorporate this concept with the kinematic equations. The main kinematic equation and the only one you really need is xf = 0.5at2 + vt + xi. In Unity, we can make a script in C# that has a function with the kinematic equation coded in. This way we can set up some initial conditions and launch objects in our video games.
Kinematics is pretty good, but there are some drawbacks. The biggest one (at least for us game developers) is the fact that handling collisions with kinematics is very difficult because you would have to program it all yourself. It is a much better idea to let the unity game engine handle all of that stuff and you use forces.
A force is a just a mass times an acceleration, and they can be constantly applied to an object to accelerate it realistically. We can use forces in our games this way to simulate things that are constantly getting faster. The demo I used in the video was rockets accelerating forward in space. In Unity we can use forces by calling the AddForce function on our Rigidbody.
Friction is a type of force that resists the motion of two objects in contact and is the force responsible for making objects stop moving when no other force acts on them. The force of friction is equal to the coefficient of friction times the force normal. In unity we set this up by adjusting the two friction values in a physics material. the friction values on the two objects in contact get combined somehow to produce the coefficient of friction used in the actual calculation. If no physics material is on an object it will behave as is it has a static and dynamic friction of .6
Drag is another resistive force that resists the motion of an object as it is suspended in free fall. The force of drag (simplified version) is equal to -bv. In unity however the drag variable doesn't equal b, it equals b / m or g / vt where vt is terminal velocity.
There are 3 main types of collisions, elastic collisions, where no energy is lost, inelastic collisions, where some energy is lost, and perfectly inelastic collisions, where all energy is lost. No matter what type of collision you are facing, momentum is always conserved. We can determine a collisions elasticity in unity by using the bounciness variable in our physics materials.
Impulsive forces are a way for us to quickly change an objects momentum. We could realistically do this by having a very high force acting over a short time, or we could just do a cheeky game developer move and do it instantly. To do this in unity all you have to do is type ForceMode.Impulse as the second argument in the AddForce function. This is probably one of if not the most important topics in the video.
Rotational motion is broken up into two mini sections with the first being on rotational kinematics. It's exactly the same as regular kinematics except just using the rotational variables. The next mini section is on rotational dynamics mainly just focusing on torques. Torque is the measure of the force that causes an object to spin around an axis. It equals the position vector crossed with the force vector, and also an object's moment of inertia times its angular acceleration.
In the last section I just went over everything else about the Rigidbody component in Unity.
Discord: Will Hess(hashtag)9883
If you have any questions DM me over Instagram or Discord
Комментарии