Unity and Havok Physics for DOTS-based projects

Create rich, interactive, and dynamic worlds powered by Unity’s C# Data-Oriented Technology Stack.

Two physics systems, one data protocol

The Physics solution consists of two offerings: Unity Physics and Havok Physics. Both are based on the DOTS framework, so they use the same data protocol.

This allows you to seamlessly transition your projects between physics systems without having to rebuild your content or game code.

Whether you’re using Unity Physics, Havok Physics, or both in unison, the unified data protocol allows you to author once, and simulate using any DOTS-enabled system.

Behind the scenes: The Unity and Havok partnership

In collaboration with Havok, we developed a brand new physics engine built on the DOTS technology.

Hear Shawn McClelland (Product Manager at Unity) and Joel Van Eenwyk (Field Application Engineer at Havok) explain how we partnered to build the systems on top of the DOTS framework, which enable you to create physics simulations that deliver exceptional performance compatible with modern networking needs.

Unity Physics and Havok Physics

Unity Physics and Havok Physics are built on top of the Data-Oriented Technology Stack (DOTS) framework. You can transition a project from one solution to the other, and they can run simultaneously. They are data compatible and let you use Unity’s powerful tools and workflows.

Unity Physics

Fast. Light. Stateless. Customizable. That's the mantra behind our new Unity Physics solution.

Built on top of the Unity C# DOTS framework, it is network-ready, completely customizable, and built for performance out of the box. Whether you're building the next mobile hit or a new networked multiplayer console experience, Unity Physics leverages the Burst compiler and Job system to scale across a range of hardware.

Unity Physics is currently in Preview release, available via the Package Manager, and compatible with Unity 2019.1 and later versions.

Havok Physics

Havok Physics
Havok Physics represents a high-end solution for customers who need to produce complex physics simulations. It’s backed by the industry-leading Havok Physics engine, which powers over half the top titles of this console generation. It is written using the same C# DOTS framework as Unity Physics, but includes the features, performance, stability, and functionality of the closed source, proprietary Havok Physics engine, written in native C++.

Check out the documentation on how to access Havok Physics.

Havok Physics is heavily optimized for typical game use cases. Core algorithms have been refined over many years, and various automatic caching strategies (including enabling sleeping for inactive objects) mean that CPU resources are spent only where needed. 

See Havok Physics Unity integration : Performance - YouTube 

Havok Physics is a robust physics engine designed to handle the performance demands of the most graphically intense games, which often include intricate scenes with lots of physical interaction. By working with partners across the industry for over twenty years, Havok has seen, solved, and continues to iterate on many of the hardest problems facing physics simulations. This means stable stacking of physics bodies, minimal artifacts where there are fast-moving bodies, and generally more controlled behavior, especially when working with non-optimized collision geometry. 

See Stacking Stability - YouTube and Mesh Welding - YouTube

What does “deterministic” mean?

Determinism is about getting the same outcome in a physical simulation when it is given the same set of inputs. Both Unity Physics and Havok Physics provide deterministic results. However, because different CPU architectures (x86, ARM, etc.) produce minor differences in their mathematical calculations, the deterministic results of the simulation may be different on different hardware.

Because Burst will solve the problem of cross-architecture determinism later this year, Unity Physics will automatically benefit from this feature as well, meaning that the simulation would be the same on any device.

Note: For single-architecture determinism, Unity Physics will require an upcoming Burst update.

What does “stateless physics” mean?

Most physics engines, including Havok, achieve performance and stability with intelligent optimizations, such as caching parts of the world state in order to bypass or stabilize different calculations. Stateless physics instead achieves performance through brute force optimizations. Because of this, and because future versions of Burst will be able to execute across multiple architectures, it can benefit several different networked scenarios. On the other hand, there are some scenarios where Havok can achieve greater performance and stability.

How does stateless physics impact networked games?

Because stateless physics will be able to execute deterministically across multiple CPU architectures in future versions of Burst, it will be ready and easy to use for a variety of networking setups, including client-side prediction (e.g., FPS), lock-step client simulation (e.g., RTS), as well as GGPO/rollback (e.g., fighting games).

What are the benefits of using Havok Physics in my games?

Because Havok Physics caches different state information to perform intelligent optimizations, it can achieve superior performance in large-scale games or games that use complex physics systems. Havok Physics also offers greater stability in handling interpenetrating objects and stacking bodies. Behavior will also be improved due to an advanced friction model that requires caches.

Can I retroactively apply Havok Physics to my existing games? If so, how difficult is this?

Both Havok Physics and Unity Physics use the same data model in the Unity editor. You can author content in a single way, and opt into either or both physics back ends, depending on the specific needs of your game or subsets of your game worlds.

Will the new system break anything or introduce complexity to current or future projects?

No. Both Havok Physics and Unity Physics are opt-in packages based on DOTS. No existing content will break, though you may need to retune your existing content if you migrate to one of the new back ends.

We use cookies to ensure that we give you the best experience on our website. Visit our cookie policy page for more information.

Got it