Collision Model - NeisesMike/VehicleFramework GitHub Wiki

A visual example

https://github.com/NeisesMike/SubnauticaAtramaVehicle/blob/main/Images/wiki/hierarchy/collision_model.png

Purpose of the Collision Model

The purpose of the CollisionModel (besides colliding with the world) is to ensure Leviathans interact appropriately with the vehicle. For example, the Reaper Leviathan will disable the CollisionModel during when it grabs the vehicle. Problematically, it will grab the vehicle at the vehicle's center, which sometimes may not be a natural place to grab. This can cause bizarre physics-sickening behavior when the reaper grabs a vehicle in a way where some of the vehicle goes into the reaper's body. For this reason, you should ensure at this step that the center of your vehicle is relatively near the front:

https://github.com/NeisesMike/SubnauticaAtramaVehicle/blob/main/Images/wiki/hierarchy/odysseyCenter.png

If you don't want to do that, you can setup the Leviathan Grab Point.

What is the Collision Model

This is a collection of colliders. The colliders can exist anywhere within the transform hierarchy of CollisionModel. You must place colliders in a way that keeps the player inside the vehicle without inhibiting their movement, and the seams should be tight such that no fish can wiggle in. In the simplest format, this requires 6 "faces" of a "cube" that represents your vehicle. Each "face" in such an example would be long and tall but thin, because they form the walls, floor, and ceiling of the vehicle.

I try to use cube colliders for everything because they're performant in the Unity Engine. Unfortunately, you can't just use a mesh collider for your model. Even if it behaves correctly in the game, the log will be spamming about how non-convex mesh colliders can't be kinematic rigidbodies and stuff like that. So you have to painstakingly approximate the colliders of your vehicle with cubes for the best results.

https://github.com/NeisesMike/SubnauticaAtramaVehicle/blob/main/Images/wiki/hierarchy/hatch_plain.png https://github.com/NeisesMike/SubnauticaAtramaVehicle/blob/main/Images/wiki/hierarchy/hatch_collision.png