Motion of objects (friction, density, force, etc.)

Click For Summary

Discussion Overview

The discussion revolves around the physics concepts involved in programming realistic motion for objects in a game, focusing on aspects such as friction, density, force, and gravity. Participants explore the implementation of these concepts in code and seek advice on improving the realism of their simulations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • Joe outlines his approach to calculating volume, mass, weight, and friction in his game programming, expressing a desire for realism in object motion.
  • Some participants point out a potential error in the spelling of "weight" and question the use of 'g_force * 9.8', suggesting that weight should be calculated using the standard acceleration due to gravity (9.81 m/s²).
  • Joe clarifies that 'g_force' is a variable that can be adjusted to simulate different gravitational forces, such as those on the Moon or Jupiter.
  • Participants provide resources, specifically recommending Hyperphysics as a useful site for learning more about motion, trajectories, and equations of motion.

Areas of Agreement / Disagreement

There is no clear consensus on the correctness of Joe's implementation, as some participants raise questions about specific calculations while others focus on providing resources for further learning. The discussion remains unresolved regarding the best approach to achieve realistic motion in programming.

Contextual Notes

Participants have not fully explored the implications of using a variable for gravitational force, and there may be assumptions regarding the definitions of terms like "friction" and "weight" that are not explicitly stated. The discussion does not resolve the mathematical steps involved in Joe's calculations.

Who May Find This Useful

Individuals interested in game programming, physics simulations, and those seeking to understand the application of physics concepts in programming contexts may find this discussion beneficial.

avgprogrammerjo
Messages
2
Reaction score
0
Hy guys, I program as an hobby, and have recently gotten into game programing. As I'm to young to have taken any physics classes(I'm doubling up in science to take physics my junior year), I have had to self teach myself what I have learned so far. I am posting it here as I think I will get more of a response that I am looking for, and that is the physics part of it. So I will convert the simple physics part of my program to plain english so you can help me even if you don't know programming.
Code:
    // find volume and mass
    // first we will find volume = h * w
    volume = w * h;

    // now let's find mass = V * D
    mass = volume * density;

    // now we are going to find the gravity of the object using force = mass * 9.8(earth grav)
    wieght = mass * (g_force * 9.8);

    // find friction
    friction = friction_coe * wieght;
Now for the part that is hard to separate from the program. In the program I have it so that if the acceleration is positive it will subtract the friction, and add if negative(going in the left on x axis, or down on y).
I will give you the positive example
Code:
y_var = (y_force - friction) / mass
x_var = (x_force - friction / mass
y =  y + y_var
x = x + x_var

Now for some reason that doesn't seem to be working.
If you don't understand the equations I have layed out, please let me know where and why, as I'm sure I could miss something as it all programing language seems like my second language.
Also is there a more "realistic" way of doing it. I want my objects to be as realistic as possible.


Thanks,


Joe
 
Physics news on Phys.org
wieght = mass * (g_force * 9.8);
Well it should be 'weight', and weight is the product of mass and acceleration of gravity, which is 9.81 m/s2 at the Earth's surface (~ sealevel). It's not clear what one is doing with 'g_force * 9.8'

Friction always works in opposing the motion. It is a shear force.
 
O, I'm sorry about the confusion, in my program you are able to choose the "g_force." there fore if I entered 1 for the g_force it would be that of gravity, 2 for 2 times that of gravity etc.
g_force is simply a variable which is subject to change, if I were to for example give my world the gravity of the moon, or the planet Jupiter.

Joe

P.S. Do you know of any good articles on physics that relates to real world projection, collision, etc. As I'm trying to learn. I taught myself all of the above, and I kind of want to understand that more, as well as go more in debth as it is really interesting. I can't wait until I can take physics.
 
Last edited:

Similar threads

  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 45 ·
2
Replies
45
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 59 ·
2
Replies
59
Views
6K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 20 ·
Replies
20
Views
5K