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

Click For Summary
SUMMARY

This discussion focuses on applying basic physics principles to a 2D space game, specifically regarding the handling of a player's ship with varying mass and thrust from different components. Key concepts include motion, force, and torque, which directly influence the ship's acceleration, deceleration, and rotation. The user seeks to calculate the effects of added components, such as guns and engines, on the ship's performance and stability, particularly in relation to its mass distribution and thrust capabilities. Understanding these principles is essential for accurately simulating the ship's behavior in the game environment.

PREREQUISITES
  • Understanding of basic physics concepts: motion, force, and torque
  • Familiarity with 2D game development principles
  • Knowledge of programming for physics calculations
  • Experience with game engine physics (e.g., Unity or Godot)
NEXT STEPS
  • Research how to calculate force and acceleration in a 2D environment
  • Learn about torque calculations and their impact on object rotation
  • Explore physics engines compatible with your programming language
  • Study mass distribution effects on vehicle handling in game design
USEFUL FOR

Game developers, particularly those creating physics-based 2D games, and programmers looking to implement realistic motion and control mechanics in their projects.

RagingPineapple
Messages
21
Reaction score
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
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.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 16 ·
Replies
16
Views
10K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K