Determining if a force is making a difference

  • Context: Undergrad 
  • Thread starter Thread starter DrSammyD
  • Start date Start date
  • Tags Tags
    Difference Force
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 2K views
DrSammyD
Messages
21
Reaction score
0
So I'm creating a game. I have a physics engine in the game. There's a use case that I've come up with that I don't know how to solve.

Imagine a character is running
1.
---------0 ------------------>
-------------------------------------------

then it hit's a wall
2.
---------0>| BLAM!
-------------------------------------------

now it's no longer moving forward.

now Imagine a character running on a treadmill
3.
---------0>
-----<------<-----<------<-----<------<

Then a wall comes down the treadmill
4.
<-------0| BLAM!
-----<------<-----<------<-----<------<

Or the character is running on a treadmill but not fast enough to keep up
5
-----<--0
-----<------<-----<------<-----<------<

I need a variable that will determine that cases 1 and 3 are the same, and 2 and 4 are the same, when the only information I have are the forces acting on the character (the ground, the box, friction etc.), the force that the character is providing itself (e.g. the running force), and the character's velocity.

I'm trying to determine the speed at which the running animation should be played. clearly in cases 2 and 4, it should not be playing, in 1 and 3, it should be, and in 5, it should be playing, but more slowly than in case 1 and 3. I was multiplying the animation speed by the velocity, but then I realized it wouldn't work in the case of the treadmill

Is this possible with the information I have? If not what other possible information combinations do I need?

The short question is, how do you measure if a single force is changing the velocity of an object given all other forces acting on it and it's current (and perhaps past if I need to record it) velocity, and if so, how much.
 
Last edited:
Physics news on Phys.org
I say don't worry about forces. I don't see how they can help your case here. Just worry about velocity. And, perhaps position.

Make a variable for the speed of the ground (or treadmill): G
Make another variable for the speed of the character: V
Make another variable for the speed at which the running animation should play: A=V-G

You might need to make position variables for the wall, the ground, and the character. The position of each will obviously change depending on their speed and time...so you'll need a time variable as well.
The position of the wall can be fixed to a position of the ground.
Make a case that when the position of the character=position of the wall, then V=G

Simple. I should have been a computer programmer :P
 
If you do want to use forces, here is how you go about it.

1) Running must apply a constant force in specific direction.
2) There must be friction with the supporting surface. Make sure to take relative velocities into account.
3) Collisions must apply forces. This is a tricky one. Simplest thing is to compute how far object A went into object B and use Hook's Law. However, this will generally cause objects to separate with a bit more velocity than they hit. It's a good idea to also apply friction during collisions. It can solve the above problem, and allow you to make slightly different collisions between different materials.
 
Is there a way to get the relative velocity based on the force of the friction it's applying to me?