Hey. So. I need a function to calculate the resultant angle and speed that two colliding objects will travel in after collision.
Basically object A is traveling 38 degrees at a speed of 5 units per .05 seconds, object B is traveling 112 degrees at a speed of 10 units per 0.05 seconds and they collide. Mass can be easily adjusted on either object but for the sake of argument we'll say object A is a mass of 1 and object 2 is a mass of 2.
This example is just using in-game real variables, calculating the collision on a 2D plane.
Preferably this function would also be able to calculate the resultants after one object collides with an immovable second.
I have no idea where to start when it comes to physics, and searching over the internet just brings up a bunch of functions that don't explain themselves in the slightest, everyone just assumes you know what everything means and why it means what it does -.- I also never took physics.
You will have to be specific as to where you get stuck in terms of physics. When two objects collide they transfer energy to each other. When a moving object collides with a solid, immovable object, the movable object transfers it's energy to the solid object and bounces based on it's own elasticity, like a spring. I recommend you experiment with simple collisions and move up from there as you learn more.
thanks but that's exactly what I'm talking about -.- they use all these physics terms I don't understand in relation to functions that aren't explained. And, as a result, doesn't help me at all.
I simply need a function (or separate functions) that returns the new movement direction (in terms of an angle) of one of those objects (adjustable) after collision as well as the new speed that it is traveling at. I don't know how I can be more specific than that. All of the information is provided I just need a function that returns those details :S
there is no "simple collisions" to move up from! >.< I just need the function, the simple function that takes the given directions and speed, and returns the resultant angles and speed after collision. I know there is one, I know it's simple, I remember seeing it once in math class, but I can't find anyone able to provide it.
Come on, it's really simple stuff. It's like adding 2 lines together. Just spend an hour or so researching it, starting with that article and you'll grasp it, I promise.
Come on, it's really simple stuff. It's like adding 2 lines together. Just spend an hour or so researching it, starting with that article and you'll grasp it, I promise.
graaagh, thats what I said! Yet I have now spent days in multiple instances searching for the information with no avail, everything I come close to starts simple then explodes into crazy functions that I don't need :S
Again, I have never taken physics, the very limited knowledge I do have is that learned from wikipedia and advanced math class.
This is incredibly frustrating, and the fifth time people have told me to do exactly that, instead of just helping -.-
not to mention the few things I do come across I have no idea how to replicate in the editor considering I can't exactly add "km/h [E]" to all my real values and have the game understand what I'm talking about.
I have tried over and over to teach myself how to do this, but nothing helps, everyone overcomplicates the shit out of it for no reason. I just need the basic function, from there I can reverse engineer the variables and find out how to replicate and perfect it for the situation.
K this is really fucking pissing me off now, can you please, pleeeeaaasssee just help me out with this function? I have spent the last two hours doing exactly what you said but it hasn't helped me in the slightest.
Rollback Post to RevisionRollBack
Zergling Blood : starcraft://map/1/35684
Game of Thrones : starcraft://map/1/189756
Tacticraft : starcraft://map/1/223625
See step 4. Though, it wouldn't really work on its own without step 3, I'm assuming that your units will be colliding simply by walking into each other. In that case, you'd just get their velocity vectors as ( cos(Direction)*Speed, sin(Direction)*Speed ) instead of ( custom value 0, custom value 1 ) as used in the tutorial.
Oh, and in the tutorial, custom value 4 represents the mass of the unit.
Hey. So. I need a function to calculate the resultant angle and speed that two colliding objects will travel in after collision.
Basically object A is traveling 38 degrees at a speed of 5 units per .05 seconds, object B is traveling 112 degrees at a speed of 10 units per 0.05 seconds and they collide. Mass can be easily adjusted on either object but for the sake of argument we'll say object A is a mass of 1 and object 2 is a mass of 2.
This example is just using in-game real variables, calculating the collision on a 2D plane.
Preferably this function would also be able to calculate the resultants after one object collides with an immovable second.
I have no idea where to start when it comes to physics, and searching over the internet just brings up a bunch of functions that don't explain themselves in the slightest, everyone just assumes you know what everything means and why it means what it does -.- I also never took physics.
You will have to be specific as to where you get stuck in terms of physics. When two objects collide they transfer energy to each other. When a moving object collides with a solid, immovable object, the movable object transfers it's energy to the solid object and bounces based on it's own elasticity, like a spring. I recommend you experiment with simple collisions and move up from there as you learn more.
http://en.wikipedia.org/wiki/Euclidean_vector
thanks but that's exactly what I'm talking about -.- they use all these physics terms I don't understand in relation to functions that aren't explained. And, as a result, doesn't help me at all.
I simply need a function (or separate functions) that returns the new movement direction (in terms of an angle) of one of those objects (adjustable) after collision as well as the new speed that it is traveling at. I don't know how I can be more specific than that. All of the information is provided I just need a function that returns those details :S
there is no "simple collisions" to move up from! >.< I just need the function, the simple function that takes the given directions and speed, and returns the resultant angles and speed after collision. I know there is one, I know it's simple, I remember seeing it once in math class, but I can't find anyone able to provide it.
Come on, it's really simple stuff. It's like adding 2 lines together. Just spend an hour or so researching it, starting with that article and you'll grasp it, I promise.
graaagh, thats what I said! Yet I have now spent days in multiple instances searching for the information with no avail, everything I come close to starts simple then explodes into crazy functions that I don't need :S
Again, I have never taken physics, the very limited knowledge I do have is that learned from wikipedia and advanced math class.
This is incredibly frustrating, and the fifth time people have told me to do exactly that, instead of just helping -.-
not to mention the few things I do come across I have no idea how to replicate in the editor considering I can't exactly add "km/h [E]" to all my real values and have the game understand what I'm talking about.
I have tried over and over to teach myself how to do this, but nothing helps, everyone overcomplicates the shit out of it for no reason. I just need the basic function, from there I can reverse engineer the variables and find out how to replicate and perfect it for the situation.
K this is really fucking pissing me off now, can you please, pleeeeaaasssee just help me out with this function? I have spent the last two hours doing exactly what you said but it hasn't helped me in the slightest.
@EchoedRequiem: Go
Im pretty sure there's a function in the editor that claculates the bounce angle for you already. I'll check it out and get back to you.
http://wiki.sc2mapster.com/galaxy/triggers/reflected-point/
Any use? http://forums.sc2mapster.com/development/triggers/22969-bounce-of-region/
@grenegg: Go
Hmmm thanks guys, I'll see if this helps and report my findings
So, you looked everywhere except the tutorials forum? Because it has exactly what you need.
http://forums.sc2mapster.com/resources/tutorials/22121-triggers-implementing-a-physics-engine/
See step 4. Though, it wouldn't really work on its own without step 3, I'm assuming that your units will be colliding simply by walking into each other. In that case, you'd just get their velocity vectors as ( cos(Direction)*Speed, sin(Direction)*Speed ) instead of ( custom value 0, custom value 1 ) as used in the tutorial.
Oh, and in the tutorial, custom value 4 represents the mass of the unit.
Why isn't this in here:
http://wiki.sc2mapster.com/galaxy/tutorials/
It should be...
I don't know, how do you get it on there?
But I just added it 4 u ; )
I'ma necro this topic hard, I'm lookin for the same thing, the after-bounce angle of a moving object
this was answered already.
@FunkyUserName: Go
how where what?