Quick start guide for Havok Physics
This guide aims to get you up and running as quickly as possible with Havok Physics for Unity.
The steps below make use of the Unity Physics Samples publicly available on GitHub (see the Unity Physics Samples documentation for more details).
Adding the Havok Physics for Unity package
- Get the Unity Physics Samples if you don't already have them.
- Open the
PhysicsSamples
project Add the Havok Physics package..
..via Package Manager
- Open Unity's Package Manager from the Window > Package Manager menu item
Select Packages: Unity Registry, select and install Havok Physics for Unity. Note that the Install button is at the top right of the window.
..or via zip download
- If receiving the packages outside of the package manager unzip Havok.Physics.zip to desired package directory outside of the new clone directory e.g. D:\Packages\
- Locally modify the samples project's manifest to add this package as a dependency.
"dependencies": { ... "com.havok.physics": "file:D:/Packages/Havok.Physics/com.havok.physics", ... }
Ensure the Havok Physics plugin is installed by checking in the Packages subfolder.
Change a scene to simulate with Havok Physics for Unity instead of Unity Physics
- Open the
Pyramids
test scene located in Assets\Tests\Pyramids.
- Press Play to simulate the scene using the stateless Unity Physics backend.
- Stop the simulation to reset the pyramid stack.
- Toggle on the
PyramidsSub
subscene in the scene hierarchy. - Select the
Physics Settings
node. - In the inspector, change the Simulation Type of the
Physics Step
component from Unity Physics to Havok Physics.
Note: the Simulation Type in thePhysics Step
component can also be toggled at runtime as well. - Press Play to simulate the scene using the Havok Physics backend.
- In the Game tab use the left mouse button (LMB) to click and drag dynamic rigid bodies. Holding the right mouse button (RMB) activates mouse look and the 'ASWDQE' keys move the camera.
- Observe that the simulation is more stable than it was in Unity Physics, due to the use of simulation caches in Havok.Physics. This is just one example of how Havok produces a more realistic behavior.
The Havok Physics simulation behavior can be further configured in any scene by using the Havok Configuration component. The simulation can also be analysed with the Visual Debugger.