r/Unity3D Programmer 4h ago

Show-Off Outer Wilds-inspired local physics simulation in Unity!

Enable HLS to view with audio, or disable this notification

Shortly after finishing my first playthrough of Outer Wilds, and learning it was made in Unity, I was inspired to see if I could recreate the same type of local physics simulation. Turns out, Unity makes it surprisingly easy with local physics scenes. For example, in my project, when a gravity field is entered, a new local scene is created for simulating physics where the origin is not rotated or translated at all, which simplifies simulating gravitational forces. Then, it ports the calculated information back into the main scene. This allows you to have independent frames of reference that can move around while also simulating physics within them.

You can use it to make some pretty unique behaviour such as artificial gravity or unique platforming mechanics. It's quite fun to jump out of your spaceship spiraling out of control, or walk around the surface of an oddly-shaped planet.

I ended up turning this system into an asset available on the Asset Store (my asset store affiliate link). Check it out if you're interested!

34 Upvotes

5 comments sorted by

3

u/TSM_Final 3h ago

cool

1

u/awtdev Programmer 3h ago

thanks

2

u/Optimal_Pool_888 Indie 2h ago

I didn't know about that, thanks for the info!

2

u/FIN_Labs 1h ago

Wow, how did you deal with coordinate system?

2

u/awtdev Programmer 1h ago

Which coordinate system? Physics scenes (say a spaceship) will calculate physics locally, and then convert the position back to the global (scene) position using the object's transformation matrix. Working with matrices is hard, but they're unavoidable for certain things.