Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I learn the basics of game physics and the math behind it? [closed]

Tags:

math

I taken math in college (trigonometry, calculus II...) but I don't know why you use tan, arctan, etc., in game physics. I know I can find working code and understand everything except why I am using a particular trig function, but I don't want that.

I want to know why I am using arctan or sin. Where can I learn about why I am using that particular math function to make a ball bounce realistically?

Thanks for any help.

EDIT: Do I need to have taken an entry level physics class to understand game physics?

like image 220
johnny Avatar asked Dec 02 '22 07:12

johnny


2 Answers

You are using trig, essentially, to convert between different representations of the same world. A velocity can be expressed in a 2D world as one angle and a magnitude. Or as a delta x and a delta y.

You're using sine and cosine to convert from (in 2D again) polar coordinates to rectangular coordinates. You're using arctan to go the other way. (Hopefully, your language has an arctan2 function to get you into the correct quadrant.)

You don't strictly need the trig--I've done entire 3D commercial videogames in vectors, including all the camera moves. If you learn the relationship between vectors, matrices, and angles, you'll know how.


Edit to address the question's edit:

Do you have to take an entry physics class for game physics?

It can't hurt. It depends on how realistic you want your physics. There's a lot of fake physics in games and there's some "real" physics, too. I did a whole billiards game with just a couple equations. Let me address a couple of common areas.

  1. Collisions. Equations are simple. It's the implementation that's tough. You don't need the physics class.

  2. Friction & spin. This is hard in discrete time no matter how well you know textbook physics. Some of this you'll end up faking, but it helps to know the real stuff.

  3. Strings, pulleys, levers, stacked boxes, etc. Yeah, take the class.


Another consideration is how much of your game is physics-based and how much isn't. If a giant monster throws a building at another building, what happens? The building may have a falling animation that is not physical. What happens if a monster's tail sweeps through a building as a result of an artist's animation of the character? Very few games are 100% physical.

like image 101
Nosredna Avatar answered Jan 02 '23 20:01

Nosredna


The OReilly book Physics for Game Developers sounds like it's of use here

like image 44
Brian Agnew Avatar answered Jan 02 '23 21:01

Brian Agnew