1
$\begingroup$

I am trying to build a simulation of gravity in LibGDX using Bullet physics.

To simplify it, I just want to apply a force on some body towered a (0,0,0) point.

I got my body mass and it's location and I want to use the applyForce method from the bullet api. I need to give it two parameters the force and the direction.

Direction is easy to calculate it's just a vector opposite to the location, but how to calculate the force? Also the API require the force to be a vector, while I thought this should be a number, can you explain me why is it this way?

$\endgroup$
  • $\begingroup$ Are you sure it is asking for a force and a "direction"? It looks like instead it is a force (which is a vector) and a location where the force is applied. $\endgroup$ – BowlOfRed May 20 '16 at 15:34
  • $\begingroup$ @BowlOfRed maybe, they got another method applyCentralForce, that only except one vector force vector. But my problem is that I don't understand how a force can be a vector, in my head I see it as a direction vector and some power number $\endgroup$ – Ilya Gazman May 20 '16 at 16:12
2
$\begingroup$

But my problem is that I don't understand how a force can be a vector, in my head I see it as a direction vector and some power number

Right. If the direction is a "unit" vector, then you can compare the magnitudes of different forces to compare the strengths.

But you can multiply the magnitude and the direction to get a new vector that contains both.

As an example if you had a direction of $(1,0,0)$ and a magnitude of $5$, then you can represent the force as a single vector of $(5,0,0)$.

| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

Force has both a magnitude and direction, which are the properties of a vector. The magnitude can be given by $\vec{F} = G\frac{M_1M_2}{\vec{r^2}}$ where $G$ is the gravitational constant and $M_1,M_2$ are the masses. the distance from each other is represented by the vector $\vec{r}$ which will be the displacement from the origin.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.