Jump to content
  • Advertisement
Sign in to follow this  
keepoffthegrass

Newbie question

This topic is 4367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a simple, top down spaceship game that will model newtonian physics. I want to use oop to model ships etc. A ship can contain 'engines' (a collection of engine objects) that can be located anywhere on the ship. The engines will know their position and orientation relative to the ships center of mass. The engine will provide thrust which will act upon the center of mass of the ship. Should my ship and engine objects be responsible for working out how this thrust acts upon the center of mass i.e. calculates all the vectors etc Or should I use a seperate physics engine. Can anybody point me in the right direction to start with?

Share this post


Link to post
Share on other sites
Advertisement
Simply put, no. You should have a physics engine that does the calculations for you. Your Spaceship class should just tell it the information that it needs. The Engine class should apply the forces to the Spaceship.

Of course, OOP is a tool, not a religion. If you can think of an easier/simpler way to do it, then that is fine, too.

Share this post


Link to post
Share on other sites

I'm not sure how you approach interfacing the ship and its collection of objects with a physics engine - I've never used one!

Would you suggest that i build the physics engine myself? If so, are there any tutorials that you can recommend regarding your suggested approach?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!