1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

General (inaccurate) Kinetics Simulation

  1. Dec 9, 2003 #1
    Hi. I'm designing a computer game at the moment (it's still in the theory stages right now, since I can't get much done until I've got a working engine for it) -- I make 'ammateur' games as a personal hobby in my free time. However, my latest attempt is a bit more mathematically ambitious than my usual ones, primarily in physics. Unfortunately, I'm terrible at physics AND mathematics, so I'm hoping you guys can help me out with the formulae, etc.

    Basically, the game is a 2d 'sidescrolling' game. The player controls a spaceship in which they navigate the map from left to right. Simple. The problem is this: The player can customise their vehicle.

    Ultimately, they can choose from two types of chassis -- 'heavy carrier' and 'light skirmisher'. There are lots of different chassis you can choose, but they fundamentally come within those categories. Each chassis has various numbers of mounting plates, in varying locations, and varying numbers of engines, also in different locations (for example, the heavy vehicles would have engines on the underside to counter gravitational pull, whereas light vehicles have wings). You can buy parts for your ship (guns, shields, armour, etc), and these can be placed on any of the mounting plates available to you.

    However, each peripheral you attach has its own mass, and this mass SHOULD affect the physics. So if a heavy carrier with a massive gun turret on the top rear is speeding along and suddenly brakes, the back would lift a little. If the back is heavier then the front, then the rear countergravitational engine should have a much harder time keeping it up than the other end.

    That's my problem. Knowing how switching engines on/off, the varying masses and locations of the mountings, as well as gravity, the chassis' and mountings' inertia, and the thrust of the engines, would all coalesce mathematically. In short, I know nothing about physics.

    Basically, each vehicle has a point of rotation, it can rotate 360 degrees, it can move 2 dimensionally (up-down, left-right) only. An example of the kind of things I suppose I would need to know are the math to find out:

    .How the cumulative mass of the vehicle and all its mountings should affect decelleration.
    .How weight distribution would affect rotation (eg: A heavy rear end (no jokes:)) would cause a rotating vehicle to swing around a lot; and making the back end lift/drop a little when slowing down depending on the weight distribution, etc)
    .How weight distribution, the thrusts of the various engines, and other factors, would affect the point of rotation.
    .How weight distribution would make one thruster have more strain than another, and force one end to 'hang' against the force of that engine.

    That kind of thing. Sorry if it's asking a bit much, but can anyone help out?
  2. jcsd
  3. Dec 9, 2003 #2
    Sounds like a fun project :)

    Let's see here:

    ".How the cumulative mass of the vehicle and all its mountings should affect decelleration."

    If it's a spacecraft, may I assume you are using engines for both acceleration and deceleration? If so, I would suggest using [tex]F = m a[/tex] where F is the force of the thrusters, m is the mass of the craft, and a is the acceleration. So, in your case, rearrange to a=F/m. You can do a reasonable approximation of change in speed each time step in your simulation by something like
    [tex]v = v_0 + \frac{1}{2} a t^2[/tex]

    where [tex]v_0[/tex] is the old velocity and [tex]v[/tex] is the new one and [tex]t[/tex] is the time step. Being a game, you might think about throwing in some regions where it "locks" just to make it play easier (like locking at velocity=0 when they are really close).

    ".How weight distribution would affect rotation (eg: A heavy rear end (no jokes:)) would cause a rotating vehicle to swing around a lot; and making the back end lift/drop a little when slowing down depending on the weight distribution, etc)"

    I think what you are referring to here is angular momentum. The intuition is that when mass if distributed further away from the point of rotation, it is more difficult to change the rate of rotation. In your case this could be a challenge to model well.

    In essence, a body in free space will want to rotate about its center of mass. For your models, I suspect this would be easy to calculate, just take a weighted average of all the "stuff" the craft is made of in both the x and y directions independently. This is the point your craft will want to spin about when an unbalanced force is acting on it. So the burning question is of course, how much does it spin? There are a few formulas to take into account. Like regular kinematics, rotation has equations that are similar.

    One describes the rate of rotational acceleration: [tex]\alpha = \frac{\tau}{I}[/tex] Here, [tex]\tau[/tex] is the torque on the object and [tex]I[/tex] is it's moment of inertia.

    Torque can be calculated as [tex]\tau = F l[/tex] where [tex]F[/tex] is the force *perpendicular* to the "moment arm" as it extends from the center of gravity and [tex]l[/tex] is just the length of this "moment arm".

    Moment of inertia can be thought of a lot like mass pieces in combination with how far it is from the center of mass. In this case, it looks something like [tex]I = \Sigma m r^2[/tex]. Here, [tex]m[/tex] are the masses and their associated [tex]r[/tex] is the distance from the center of mass of the craft.

    Ok, there are some formulas to look at. It think I'll stop here and let you ask some questions, which no doubt you have. Feel free to ask about notation if something isn't clear.

    (edit, typo)
    Last edited: Dec 9, 2003
  4. Dec 10, 2003 #3
    Thanks for the reply.:smile:

    There are a few things I don't understand:
    1. 'Moment Arm'?
    2. What's the '[tex]\Sigma[/tex]' character mean?

    Also, how would one go about finding the point of rotation (since locations of mounting plates, and thrusters would change from chassis to chassis, and some thrusters could be damaged or switched off even at runtime)?

    Thanks again, hopefully I'll be able to apply this stuff.
  5. Dec 20, 2003 #4
    1. the moment arm is the distance between where a force (torque in this case) is applied and where it acts - the centre of mass of an object.

    2. This sign means summation - a series of terms of an equation are added together. in the calculating inertia (I) we break a thing we're looking at into little bits of mass along the dimension of it and add each little mass times the distance-squared, I = sum along r of dm x r^2 from one to the other of our object. btw, the total mass will be the sum of all dm's.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook