Orbital Gravity

Does someone know how to make a planet with orbital gravity exactlly like Angry Birds Space planet gravity?
I want that the object will move around the planet only when it get into a field.
I also want that the object will land on the ground after some rounds like angry birds space.

*I use c# and unity 2d.

Write a custom controller that:

  • Checks if the character is nearby “planet”, either by Physics query (e.g. by overlap sphere), or by any other mean.
  • If it is, calculate a direction to that planet (its your gravity now)
  • Apply force, or movement towards it, based on the distance.
  • Rotate your character pivot as well to face that direction correctly.
  • Use default gravity only if you hit nothing by the query.

It shouldn’t be that hard.

Thanks for the help but I am a beginner.
Can you please make a script of that?

No way :smile:

Start from the Learn section and work it out step by step.

1 Like

I want to learn from the script.

There’s plenty scripting tutorials there. Just start small.