Need some help applying basic physics to a 2d environment.

In summary, understanding motion, force, and torque is essential for your side-scrolling space game project. The total mass and thrust capabilities of your ship, as well as the position of mounted units, will affect its performance and movement. Calculating these variables will allow you to determine the ship's movement in your 2D world. Best of luck!
  • #1
RagingPineapple
21
0
Could someone help me understand the principles behind a few things in physics? I'm trying to build a little side-scrolling space game where you can bolt add-ons and engines to your ship. Each has its own mass (and in the case of engines, their own maximum thrust), and therefore affects the handling of the ship.

The downer is, I suck at physics. So explanations using notation usually make no sense to me.

Also, ultimately I'm interested in retreiving variables that are useful in a 2d-world. I need to be able to handle formulae in such a way that when each frame is redrawn, I don't just know the various amounts of torque or inertia that are affecting the ship, but also what basic effect they'll have in 2d. How much is it going to move on the X/Y axes, how much will it rotate by, and around what point?

Fortunately, the only ship which needs to be physics-enabled is the player's ship. Everthing else will be much simpler, such as enemy vessels.

Unfortunately, I'm not using a very common programming language, so I can't just reference a pre-existing library or find a tutorial.

Anyway, what I'm hoping to achieve physics-wise is:

The effect where adding different mountings, such as a big gun on the top, will adversely affect the control of the vehicle. So the total mass (and the thrust capabilities of the engines) of the ship will affect its overall performance in terms of acc/decceleration/etc.

But also, the elements of twist on the main body as a result of the additional components. For example, if you have two engines on the underside fighting gravity, and one is destroyed, gravity will pull down one end while the remaining engine lifts the other. The result (I believe) would be a rotation.

Similarly with the positions of the different mounted units. A large gun on the top of the ship may cause it to flip if you brake too suddenly.

Could somebody help me do this please?:smile:
 
Last edited:
Physics news on Phys.org
  • #2
Hi there! It sounds like you have a really interesting project in the works. Physics can be tough, so don't feel bad if you're struggling to understand it!

When it comes to your project, it sounds like you'd need to understand motion, force, and torque. Motion is the movement of an object over a period of time, while force is a push or pull that can make an object move. Torque is a type of force that causes an object to rotate.

For example, when you add different mountings to your ship, such as a big gun on the top, the total mass of the ship (as well as the thrust capabilities of the engines) will affect its performance in terms of acceleration/deceleration. Additionally, the position of the mounted units will affect how the ship moves -- if you brake too suddenly, a large gun on the top of the ship may cause it to flip.

When it comes to calculating the variables you need for your 2D world, you'll need to consider a few things. You'll need to know the total mass of the ship as well as the thrust capabilities of the engines, so you can calculate the force and acceleration. You'll also need to consider the position of the different mounted units, so you can calculate the torque. Based on these calculations, you should be able to determine how much the ship will move on the X/Y axes, how much it will rotate by, and around what point.

I hope this helped to explain the principles behind a few things in physics! Good luck with your project.
 
  • #3


I would be happy to assist you in understanding the basic principles of physics and how they can be applied in a 2d environment. First, it's important to understand that physics is the study of the natural laws that govern the behavior of objects in the universe. These laws can be represented using mathematical equations, but don't worry if you're not comfortable with notation - I'll try my best to explain things in simple terms.

In your game, you want to be able to understand how different components, such as engines and add-ons, affect the behavior of your ship. This can be explained using a few key concepts:

1. Mass: This is the amount of matter an object contains. In your game, each component will have its own mass, which will contribute to the overall mass of the ship. The more mass a ship has, the more force is needed to accelerate or decelerate it.

2. Thrust: This is the force generated by an engine that propels the ship forward. Each engine will have its own maximum thrust, which will determine how much force it can produce.

3. Inertia: This is the tendency of an object to resist changes in its state of motion. In your game, the ship's mass and distribution of mass will affect its inertia. A ship with a higher mass will have more inertia, making it harder to accelerate or stop.

Now, let's talk about some of the specific effects you want to achieve in your game:

1. Adverse effects of adding components: As you mentioned, adding different components to the ship will affect its overall mass and thrust capabilities. This means that the ship's acceleration and deceleration will be affected. For example, if you add a large gun to the top of the ship, it will increase the mass on that side, making it harder to accelerate in that direction. Similarly, if you add an engine on the underside, it will increase the thrust on that side, making it easier to accelerate in that direction.

2. Twisting of the ship: In your game, you want to simulate the effects of gravity and the destruction of components on the ship's balance. This can be explained using the concept of torque, which is the rotational equivalent of force. When one side of the ship has more mass or thrust than the other, it will experience a torque that causes it to rotate. This can be simulated by calculating the torque on each side of the ship and applying a
 

FAQ: Need some help applying basic physics to a 2d environment.

1. What is the difference between 2D and 3D environments in physics?

The main difference between 2D and 3D environments in physics is the number of dimensions. In a 2D environment, there are only two axes of movement (x and y), while in a 3D environment, there is an additional axis of movement (z). This means that objects in a 2D environment can only move in two directions, while objects in a 3D environment can move in three directions.

2. How do I apply Newton's laws of motion in a 2D environment?

In a 2D environment, you can apply Newton's laws of motion by breaking down the forces acting on an object into their x and y components. This means that instead of just considering the overall force on an object, you need to consider the forces acting on it in the x and y directions separately. This allows you to accurately calculate the acceleration and movement of an object in a 2D environment.

3. How does gravity work in a 2D environment?

In a 2D environment, gravity still follows the same principles as in a 3D environment. The force of gravity is directly proportional to the mass of an object and inversely proportional to the square of the distance between the objects. However, in a 2D environment, you only need to consider the vertical component of gravity, as there is no horizontal movement.

4. Can I use calculus in a 2D environment?

Yes, you can use calculus in a 2D environment to analyze the movement of objects. Calculus allows you to find the rate of change of an object's position, velocity, and acceleration, which can be useful in understanding the behavior of objects in a 2D environment.

5. How do I account for friction in a 2D environment?

To account for friction in a 2D environment, you can use the coefficient of friction. This is a value that represents the amount of friction between two surfaces. You can use this value in equations to calculate the force of friction and its effects on an object's movement in a 2D environment.

Back
Top