Pages: [1]
|
|
|
Author
|
Topic: UQM collisions (Read 2829 times)
|
jaychant
*Smell* controller
Offline
Gender:
Posts: 432
Please visit my homepage
|
As I've mentioned before, I'm making a top-down arcade space game which takes a lot of inspiration from SC2.
To keep it simple, how does UQM handle collisions? Meaning, what approximately happens when two things collide? I'm ready for something extremely complicated or even just direction at where it is in the source code.
|
|
|
Logged
|
|
|
|
Alvarin
Enlightened
Offline
Gender:
Posts: 799
|
Seing noone has answered this yet , I'll put my cent in - I do not know how the SC2 code approaches this issue and don't remember the exact physics formula for it , but what you do is momentum - multiplication of mass and velocity for each object , and then the lighter object will get bigger potion of the impulse , divided by mass will give the new speed ... I really can't remember the exact measures and how to calculate new directions , but well ... it's at least SOME answer ... Hope it helps , i'll try to find the exact math tomorrow ...
|
|
|
Logged
|
|
|
|
Dragon
Frungy champion
Offline
Posts: 86
|
I don't know how UQM does it but you can try googling "rigid body dynamics" or "rigid body simulation". You might have to include 2D in the search. The math'll get a bit hairy though.
I'd suggest approximating the colliding objects as circles and ignore torque completely. It'll keep it much simpler.
|
|
|
Logged
|
|
|
|
Alvarin
Enlightened
Offline
Gender:
Posts: 799
|
Exactly what I thought as well . Here is the article , in quite an easy language and the math is not that difficult . The article has the two colliding object as a "point" , meaning no torque will be applied , no deformation of the bodies and no energy loss to heat .
http://www.director-online.com/buildArticle.php?id=460
|
|
|
Logged
|
|
|
|
jaychant
*Smell* controller
Offline
Gender:
Posts: 432
Please visit my homepage
|
Thanks guys!
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
In case you're wondering why no torque (spinning due to colliding off-center), I remember trying to solve this problem for Intermelee, an aborted SC1-imitator. Well, I solved the problem. The problem was the data it needed as input. Doing collisions with torque was really hard on the engine. You need to know the specific point of impact and the orientation of the interface.
If those are acquirable in a reasonable time within your code, then including torque is not that bad, and would make the game much more realistic. I don't know whether that'd make it play better, though.
|
|
|
Logged
|
|
|
|
jaychant
*Smell* controller
Offline
Gender:
Posts: 432
Please visit my homepage
|
I don't think I'll use torque... I don't see a point; it's WAY too complicated for my third official game (or fourth, depending on the circumstances), and it would add very little gameplay (actually it could be irritating. An asteroid bumps into you, and it messes up your aiming! Plus, the opponent could make it impossible to turn in their direction, which would be very frustrating).
|
|
|
Logged
|
|
|
|
Alvarin
Enlightened
Offline
Gender:
Posts: 799
|
Well , if you ARE going to use torque , than you probably should use deformation also and concider crue loss due to deformation and suffocation from environment loss . Oh and if one ship frontally collides and has fromt mounted weapon it will need time to repair it . And remove all in-game sound , it's not possible in vacuum ... And I can think of multitude of such things ...
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
scale of complexity, lower is harder uniform motion, no accelerations | Spin-free motion | Torque | | | | | deformation
|
|
|
Logged
|
|
|
|
|
Alvarin
Enlightened
Offline
Gender:
Posts: 799
|
Sorry , forgot to use [sarcasm] tag in previous post .
|
|
|
Logged
|
|
|
|
Pages: [1]
|
|
|
|
|