Do i need to know physics before using Unity3D?

Started by
13 comments, last by DragonBooster 9 years, 8 months ago

Along with programming, do you have to understand a good amount of physics such as velocity,friction and etc. to make a 2D game with it?

EDIT for mods: Sorry can you move this to the API section please thanks.

Advertisement

Technically no. However, that is hinged on the fact you do not use physics in your game. You may want to understand frame per second and a few other timing items.

Developer with a bit of Kickstarter and business experience.

YouTube Channel: Hostile Viking Studio
Twitter: @Precursors_Dawn

I see, but where would i find those? Because i am very confused on how you would program a game's movement.

I would suggest taking a look at some Unity tutorials. It's been a while since I checked personally, but I seem to remember Unity's official tutorials being fairly decent at introducing basic concepts like this.

Hello to all my stalkers.

Thanks! I was really confused on where to learn about stuff like that. I saw a book called game coding complete. Does it contain the information about timing and etc.?

Nope. I've been using Unity for a year and a half now and created a 2D board game with 3D objects and I barely graduated from high school. I lost interest in math after the 4th grade of elementary school. Too bad there weren't video games in those days. I would have been inspired to study math in spite of the boring teachers.

Thanks Dan! Would you say the Unity tutorials are sufficient enough to get you started with it.

Well.... this is a tricky question. As a longtime Unity user that is developing a 3D game making a lot of use of PhysX, I would say its a clear "yes and no".

You do not need to know anything about physics when you start using the integrated physics engine, PhysX. One of the reasons for using a physics engine (besides not needing to rewrite boring physics formulas all the time) is to give physics noobs a chance of developing a game with faintly realistic looking physics in it.

Now, PhysX (and I guess all physic engines) has its limits. When you start doing easy things like chucking stuff up in the air and seeing it fall down, it all look realistic and cool. But you have to beware: the physics engine is very limited in what it will calculate, and it cheats often. You will find that you can select a "iteration count" for the physics. Why should a physic engine need to iterate? Well, I am no expert, but I guess what the engine does is skip the complex formulas and use simpler ones multiple times to come near the realistic result.

What this all means is:

At one point, you will reach the limit of what the PhysX system can handle. A good example are Wheel Colliders and Slopes. Depending on your settings, Wheel colliders will never really behave correct on steep slopes as the friction model of the wheel colliders is too simple for that.

This is where you need to step in and "extend" the physics engine by hacking (In this example I did that by measuring if the car is going uphill and increase air drag / decrease the grip of the wheel if the slope gets too steep).

So while you do not need to know exact formulas (its a game, not a physics simulation), in a physics heavy game you will have to know some "lay stuff" of physics so you can more or less accurately simulate the additional physical effects the physics engine skips.

If you just want to do a game with very simple physics or where the physics can be way off from real world physics, you will need zero physics knowledge.

The more you get into an accurate physical simulation, the more you need to know about physical RL effects. But don't dust off your physics book. In 90% of the cases, watching some youtube vids on the topic (watching rally cars fighting with a muddy slope for example smile.png ) will tell you how your objects should behave. And unless you are a physics expert and master programmer, its trial-and-error from there on anyway.

About the tutorials:

You will find all you need to start in the Unity documentation.Just search for the keywords below:

- What you need to first is add Rigidbodies to all objects that should be movable by the physics system. These objects will also need Colliders so the Physic system will recognize collisions with other objects or the ground.

- All static objects just need Colliders so the physics system can handle collisions with dynamic and static objects.

- You now need to start adding Forces to you objects, attach Wheel colliders or similar means of propelling them forward.

Be aware, as soon as you start using physics, moving your objects by script (like setting a new position directly) while still possible, can interfere with your physics simulation a lot (as the objects moved by script do not behave physically fo the physics engine, collisions between objects controlled by the physics engine and objects controlled by you will usually end with the physical objects being "blasted into orbit" (a impossibly high force is imparted on the physical objects by the non-physical ones))

Thanks a lot Gian-Reto! Your post was very informative and helps me understand Unity a little bit more. For now i just want to experiment with things 2D game related and create a 2D game. Later on i would love to create a 3D Stealth game so i think i would have to learn some physics.

Thanks a lot Gian-Reto! Your post was very informative and helps me understand Unity a little bit more. For now i just want to experiment with things 2D game related and create a 2D game. Later on i would love to create a 3D Stealth game so i think i would have to learn some physics.

AFAIK in Unity 2D Physics is just a special case of 3D Physics (PhysX constrained to two dimensions), so whatever you learn creating your 2D game will translate to later 3D undertakings.

However, as I never dabbled in 2D until now, I am not sure that is true now with all the new 2D Systems that came out with Unity 4.X ... so make sure you first check out the 2D Unity Tutorials and look there for instructions on doing the physics, before you head into the general physics documentation.

If you mix a 2D Scene with 3D Physics without constraints, the results might be hilarious (like an object getting lost in the third dimension :) )

This topic is closed to new replies.

Advertisement