Advertisement

Horizontal throw with air resistance

Started by November 28, 2015 05:25 PM
15 comments, last by IsItSharp 9 years, 2 months ago
If you mean an object which's velocity is constant, you are correct. But if you think about a constant accelerated object, it is 0.5vt. Just draw yourself a (v)-(t)-Diagramm and you will See a triangle, not a square. But i think even this would be wrong here because the acceleration changes with the velocity.
What you say makes no sense.
0.5vt must be a result of some misunderstandings of your own, but you resist to believe us.

For a falling ball (without air resistance):
Acceleration is constant (gravity)
Velocity increases linear with time
Position forms a parabola

Diagramm + code in this older post: http://www.gamedev.net/topic/672589-equations-of-motion-for-position-dependent-acceleration/
Advertisement

Ok, i've read the wikipedia article and wrote this code, hope it's correct.
It uses integration, analytical solution would be harder but i guess integration is what you want.


Thanks for your effort, i tried to apply the code to my project and it looks kind of better now but i am not sure why you use those values:


airDensity = 11.0f

i read about it on wikipedia and they said it is about 1.2 kg\m³?
I also read that the mass of the object has some influence in the air resistance but in your formula i don't see any mass?

What you say makes no sense.
0.5vt must be a result of some misunderstandings of your own, but you resist to believe us.

Sorry, my fault. mellow.png

I've chosen all constants randomly and raised airDensity up to a value until the trajectory looked like i'd expect.
Also i did not read what those constants mean exactly and have no experience with drag simulation.
I just took the formula and can't help to find the proper values.

I also read that the mass of the object has some influence in the air resistance but in your formula i don't see any mass?


Good point, i've had that in but removed it for simplicity, assuming ball mass of one.
Bringing it back, we use mass to convert from drag force to drag acceleration:


float dragForceX = vx*vx * dragForceConstant * (vx > 0.0f ? -1.0f : 1.0f);
float dragForceY = vy*vy * dragForceConstant * (vy > 0.0f ? -1.0f : 1.0f);

float dragAccX = dragForceX / ballMass;
float dragAccY = dragForceX / ballMass;

Hi and thanks for your reply,

if i use a ball mass which is < 1 i get the strange effect, that the ball suddenly starts to gain acceleration like crazy?


var dragAccX = this.velocity.x*this.velocity.x * dragForceConstant * (this.velocity.x > 0 ? -1.0 : 1.0);
dragAccX /= parseFloat(document.getElementById("mass").value); 
I guess what you see is more deacceleration caused by air resistance and maybe correct?

I've just tried those realistic values with various masses and the sim always looks good:

float ballRadius = 0.2f;
float ballMass = 0.1f;
float airDensity = 1.2f;
float dragCoefficient = 0.1f;
float dragForceConstant = 0.5f * airDensity * dragCoefficient * PI * ballRadius*ballRadius;

You can post your settings / more code / link to the site if you're sure it's wrong.
Advertisement

What happens if you use 0.01 for your ballMass?

This topic is closed to new replies.

Advertisement