Jump to content

How to generate gravity?


Robert_d1968
 Share

Recommended Posts

On 12/11/2020 at 2:29 AM, Robert_d1968 said:

Hello there. Im making a PVP game and I have made a moon in the game for PVP purposes.  The only catch is that when you go towards the side of the planet. you fall off of it.

Is there anyway to generate gravity in a model of the moon?

Thanks for any help you can provide,

Robert

I don't understand this. Gravity would point towards the center of the planet, so how can you fall off it?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 4 weeks later...

The old Windows Game Programming for Dummies came with a demo disk. On it was a 2d game with planets where you'd fire things and they had gravity behaving the way you're describing. Unfortunately, the game was named something that's also a popular name for other games. Of which I forgot the exact name of. I believe it was "Deadlock", even though that's also a 4x game that I happen to have played as well.

If anyone can find that game, you might have a lead on the type of math you need. Of course, it's just math, and if you can recreate a gravity equation, which I believe is the same as the magnet equation, (Force in relation to distance, something squared, blah) or just fake it by creating a fall-off distance where the force is greatly reduced after N units or something, you should be good.

Long story short, your problem is a math problem and you may be forced to dive into trig at the easiest, calc otherwise, and there's no getting around. Find someone who can do the equations if you can't, or go watch the tuts on game math throughout the internet. I admittedly only have surface knowledge of linear alg and whatever calc from HS.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...