Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why gravity acceleration is 0.0004 in PhysicsJS?

Or, perhaps, better, what does it mean?

What the units are supposed be?

If I'm trying to simulate friction against the "background", like this:

return this
    .velocityDirection
    .mult(mu * this.mass * g)
    .negate();

I expect to use g as 9.80665 m/s^2. It was working this way before PhysicsJS:

var
    frictionForce;
    frictionForce = vec2.create();
    vec2.scale(
        frictionForce,
        vec2.negate(
            frictionForce,
            this.velocityDirection
        ),
        mu * this.mass * g
    );
return frictionForce;

Was using glMatrix for my linear algebra.

I was considering mass in kilograms and forces in newtons (etc) but in PhysicsJS it doesn't seem to work like that. (For example: if I have a circle body with radius 1, it's 1 what? Cause it'll make difference when I have to use this value for something else, and when "converting" it to pixels on the screen)

Now that I'm using a physics library I feel like I'm missing some of the physics...

I Hope someone can point me in the right direction to understand it better. I'm going through the API Docs right now and learning a lot but not I'm finding the answers I'm wishing for.

UPDATE

I received a very straightforward answer. This is just to let anyone interested to know what I did then...

Thanks to Jasper and dandelany I came to understand how some of PhysicsJS works much much better. To achieve my "dream" of using inputs in newtons, metres per second squared (etc) in PhysicsJS (and also have configurable pixels per metre ratio) I decided to create another integrator.

It's just a slight variation of the original (and default) verlet integrator. I explain it, more or less, at this (crude) article Metres, Seconds and Newtons in PhysicsJS

like image 809
slacktracer Avatar asked May 16 '14 21:05

slacktracer


People also ask

Why is acceleration 9.8 for gravity?

A: Gravity (or the acceleration due to gravity) is 9.81 meters per second squared, on the surface of Earth, because of the size of Earth and the distance we are on its surface from its center.

Why is acceleration negative in free fall?

Any object affected only by gravity (a projectile or an object in free fall) has an acceleration of -9.81 m/s2, regardless of the direction. The acceleration is negative when going up because the speed is decreasing. The acceleration is negative when going down because it is moving in the negative direction, down.

Why is the acceleration of gravity constant?

Of course, this equation is symmetric, and the force on 2 due to 1 also has an identical form. which we define to be “g” at the surface of the earth, and is a constant if we always put different masses at the same location. This means that no matter what is, the acceleration is always a constant g.

What is the acceleration due to gravity in m/sec sq?

The value 9.8 m/s2 for acceleration due to gravity implies that for a freely falling body the velocity changes by 9.8 m/s every second.


1 Answers

The units are pixels for distance, and milliseconds for time.

So the acceleration is 0.0004 pixels/ms/ms

Using meters doesn't make sense for a variety of reasons. The number of pixels per inch changes depending on device. Also, even if you did the conversion, an acceleration of 9.8 m/s/s would appear to be really fast because usually computer simulations want to give the appearance of looking at it from a distance... so you wouldn't want a meter on the screen to correspond to a meter in the simulation.

like image 115
Jasper Avatar answered Sep 17 '22 20:09

Jasper