How To Guides
Physics Simulations

How to Use Spherical Gravity

6min
Document image
ο»Ώ

Spherical gravity is a type of gravity that is simulated in games by assuming that all objects in the game world are attracted to the center of a sphere. This is the same way that gravity works in the real world, and it allows for a more realistic and immersive gaming experience.

Hazards Example
Hazards Example
ο»Ώ

Gravity in Gaming

In games that use spherical gravity, objects are always pulled towards the center of the sphere, regardless of their orientation. This means that if you are standing on the surface of a planet, you will always feel the pull of gravity downward, even if you are facing sideways or upside down. Here are some additional tips for using gravity in game design:

  • Bottomless Pits: a classic hazard in video games. They can be used to create a sense of danger and suspense, or to simply provide a way to kill the player.
  • Water: a dangerous hazard in video games. It can drown the player, or it can be used to transport the player to different areas of the game world.
  • Spikes: another classic hazard in video games. They can be used to kill the player instantly, or they can be used to create puzzles.

Let's explore how to add some hazards into our own scenes now that we have some historical perspective!

ο»Ώ

First off, we will add a spike to the scene. Through Sceneri's intuitive interface, we will locate the "Hazard" asset in the asset browser and seamlessly incorporate it into the level using the gizmo tool.

Document image
ο»Ώ

Now that we have the spike into position we want to add aΒ Rotating ComponentΒ within the spike properties by opening the Inspector panel. Entering play we should now see the spikes rotating in the scene.

Document image
ο»Ώ

The last step we need to do is add a Hazard Component from the Add Component panel on the left side. We can then drag the hazard over to the spikes object and have it overlap the spike volume.

Document image
ο»Ώ

Overall, spherical gravity is a good option for games that need to simulate gravity in a simple and immersive way. However, it is important to be aware of the limitations of spherical gravity before using it in a game. Here are some examples of games that use spherical gravity:

  • Super Mario Galaxy: This game features spherical gravity, which allows Mario to walk, jump, and spin on the surface of planets.
  • No Man's Sky: A vast universe of planets that players can explore. The gravity on these planets is also simulated using spherical gravity
  • Elite Dangerous: This game features spherical gravity, which allows players to pilot ships in space and land on planets.

As you can see, spherical gravity is a versatile tool that can be used to create a variety of gaming experiences. By using spherical gravity effectively, developers can create games that are more realistic, immersive, and enjoyable for players.

Feedback

Please be sure to submit issues or feature requests through the embedded feedback form. In the event it is a major issue please contact us directly through Discord.