Arcane University:Mesh Collisions

The Beyond Skyrim Wiki — Hosted by UESP
Revision as of 18:35, 23 April 2021 by Gamma Metroid (talk | contribs)
Jump to: navigation, search

Collision is necessary to make objects solid in the Creation Engine. When an object has collision, it cannot be walked through, fall through the ground or walls, and also determines what parts of the object are interactable. This article will cover the different types of collision shapes and their uses, as well as the physics settings that affect how the object moves in the world.

Common Shapes

The Whiterun jail door uses a box primitive.

There are three main types of collision meshes: Primitives, Convex Shapes, and Compressed MOPP Shapes. Primitives are the simplest, and MOPP shapes are the most complex. The CPU usage required to simulate physics, therefore, is lowest for primitives, slightly higher for convex shapes, and much higher for MOPP shapes. For this reason, primitives and convex shapes are preferred, and are the only viable option for moving objects (weapons, clutter that you can pick up, etc.). MOPP shapes are reserved for static objects only (architecture, furniture, etc.).

Primitives

Primitives can be boxes (rectangular prisms—they do not have to be cubes), spheres, or capsules. These can be made in NifSkope, and are commonly used for doors and chests that are roughly box-shaped, like the Whiterun jail door, seen at right. The dimensions of primitives are adjustable in the settings of the shape block. To translate the shape within the nif, use a bhkTransformShape between the bhkRigidBody and the primitive, or the translation settings in a bhkRigidBodyT.

Convex Shapes

Convex shapes are the easiest to create, and are extremely common for clutter items and simple furniture. Simply right-click the mesh in NifSkope, and select Havok > Create Convex Shape. Adjust the roundoff error value if you need more or fewer vertices. The collision radius is an invisible shell around the collision shape, and may need to be adjusted later after testing. Smaller values result in a thinner shell. Generally, if the object is very small, it will likely need a smaller radius.

Convex shapes necessarily can not have concave areas, or "indents." For an object that needs this, use either a MOPP shape (if it's a static) or a list shape, if it is dynamic.

MOPP Shapes

MOPP shapes are created in 3D software such as Blender, 3ds Max, or Maya. They are typically much simpler (i.e. fewer vertices) than the visible mesh. This can be done either by decimating a copy of the visible mesh, or removing edge loops manually for a higher quality collision mesh. MOPP meshes can also contain multiple collision materials. They can be exported to nif format using either ck-cmd (single material only) or ChunkMerge.

Special Cases

The wooden bowl from vanilla Skyrim, showing a list shape collision.

List Shapes

List shapes are collections of convex shapes or primitives. They are often used for bowls, that need to have dynamic collision, but cannot use convex shapes, as well as many weapons. These are most easily made in NifSkope by copying a bhkCollisionObject from a similar nif and adjusting it to fit, or making the list shape by hand in NifSkope.

Constraints

Main article: NifSkope Hinge Constraints

Some objects, like books and necklaces, or hanging shop signs, may use constraints so that they swing on a hinge when the player or another actor touches them.

Animated Collision

The Riften keep door from vanilla Skyrim, showing the required settings for animated collision.

Collision that moves with an animated nif is fairly simple to set up. Create a collision object inside the animated node, so that it moves along with the visible mesh when the animation is played in NifSkope. Then make sure the settings match those in the image.

The important settings are as follows:

  • Collision Layer: SKYL_ANIMSTATIC
    • Only the animated collision object needs this. If the nif contains other collision object that don't move, they should remain in the SKYL_STATIC layer.
  • Motion System: MO_SYS_BOX_INERTIA
  • Enable Deactivation: yes
  • Solver Deactivation: SOLVER_DEACTIVATION_LOW
  • Quality Type: MO_QUAL_FIXED

In addition, the animated bhkCollisionObject should have the SET_LOCAL flag, in addition to the usual ACTIVE and SYNC_ON_UPDATE. Lastly, make sure the BSXFlags of the nif are correct.

Physics Settings

Physics settings are contained in the bhkRigidBody or bhkRigidBodyT. The only difference between these two blocks is that bhkRigidBodyT has translation enabled—regardless of what NifSkope shows, the translation fields in a bhkRigidBody have no effect.

  • Layer
  • Process Contact Callback
  • Collision Response
  • Translation
  • Rotation
  • Inertia Tensors
  • Center
  • Mass
  • Linear Damping
  • Angular Damping
  • Friction
  • Restitution
  • Penetration Depth
  • Motion System
  • Enable Deactivation
  • Solver Deactivation
  • Quality Type

Collision Material