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?
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.
Collisions. Equations are simple. It's the implementation that's tough. You don't need the physics class.
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.
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.
The OReilly book Physics for Game Developers sounds like it's of use here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With