Advertisement

Offset mass angular/linear velocity?

Started by December 06, 2013 12:26 AM
4 comments, last by ferrous 11 years, 2 months ago

Hey guys, I'm an aspiring indie developer(I'm only 14, lots of time to learn!). I've been studying physics behind game design, and I have some questions.

1. How do you calculate linear/angular velocity when two objects collide and not on the center of mass? The center of mass?(all vectors), in a 2D space?

2. I googled the above, and people are using some sort of cross function, what is it?

3. Will an objects rotation always be around the center of mass?(All circumstances)

4. How do you calculate the angle in which something has collided, and what is the calculation for a bounce?(I assume with the conservation of energy, and other such stuff, just change the direction of the velocity to rotate 90 degrees based off the semicircle of collision, but the math to me is unknown.)

5. What is a good way to detect collision if something is rotated? Take a square, 45 degrees around the center of mass, how do I detect collision? The simple less than/more than math equation for rectangles and such doesn't really fit the bill.

Thanks guys!

I suspect that a good game physics book might help, or just lots of googling will answer most of your questions.

the Cross is a Vector Cross product, which involves Vector math, which is cool stuff, and very good stuff to know for games.

For 4, you are referring to the reflection vector, which should give you a good keyword to google for.

For 5, depending on what you're doing (it sounds like a 2d game?), you may want to just have either an axis aligned or circle test, then if that passes, skip to a per pixel test for the most accuracy. (Assuming that your shapes are not actually boxes, and you're using sprites)

If that won't work, look for Oriented bounding box collision in a search engine to get you started.

Advertisement

It seems you are looking for rigid body collisions.

1. This gets complicated real fast. Reading a book on physics is a good start but if you don't want to read a book you can take a look at this http://www.myphysicslab.com/collision.html

Just be avare that there are a lot of vector math and physics related terms and if you are not familiar with them this will propably not help you much.

3. As long as your objects arent bolted down to an axel then yes. Objects always rotate around their center of mass.

4. This one is also a lot of complicated math involving a lot of vectors. The link in #1 mostly covers this if you can read all the scientific terms and know vector math.

Seeing as you are only 14 my advice is to pay close attention in math and physics classes at school. It may sometimes seem boring but when you start to understand all of it and you get your first physics simulation program working it gets fun real fast.

Also, you might want to ask your instructors about it, usually they are absolutely delighted when students show interest in math and physics problems and may help you over any stumbling blocks you may have.

Last week I started reading my science teacher's Physics Textbook from her college days. I learned today how collision works... newtons second law and such, calculate it via momentum and such, what I really want now, is that damn angular velocity calculation. But... say you have a stationary square, say 1 cm3 & 1 gram, and a second similar one, but the second one has a offset position to the left, and a right velocity, and double mass(2g). It has, say, 1 m/s to the right velocity, and has a momentum of 2 g m/s. When it hit's the other square, since it has no velocity, it has no momentum... newton's law says that the other square will start moving at 1/3 the velocity of the other square, and the other square will move at 2/3s it's original velocity... in the other direction. That's right isn't it? I think so... but from what I've learned, the other cube would just change direction, and the other cube would remain still, as it has no momentum. How do you calculate how much momentum is transferred? Or is it proportional to mass... or?

Check out the link that PunCrathod posted, the section titled:

Physics of Collision for Rigid Bodies in 2 Dimensions

This topic is closed to new replies.

Advertisement