Enable embedded collisions

Activate an existing collisions in a mesh

Summary

Published: January 20, 2024 by Akiway Last documented update: January 25, 2024 by Akiway

This guide shows you how to enable an object's embedded collision for entities without (items that you can walk through).

It's a direct follow-up to Adding Objects to the World.

As of today (Jan 20 2024), you need a collision-enabled mesh for this. We can create our own collisions with the Wolvenkit Blender IO Suite, but the tutorial for this isn't ready yet.

Wait, this is not what I want!

  • If you want to create Custom props for AMM, check the corresponding guide. Note that this mechanism applies for them as well!

Requirements

Find an eligible object

Not every object contains an embedded collision, so we first need to check if your desired mesh has one.

  • Once in-game, search for the item you want to spawn; I'll be using base\meshes\base_environment_decoration_furniture_industrial_industrial_table_industrial_table_g.ent

  • In the Spawned menu, click on Copy Path to clipboard to get the current .ent path.

After you added it, turn off the Mod Browser option; otherwise, you won't be able to get the mesh file in the next step.

  • Open the .ent file and look for the mesh component in its components array.

    • If the selected entity is from allmeshes (starts with base\meshes\ ), then there is probably only 1 entPhysicalMeshComponent called custom_mesh

    • If not, it means your entity is from the vanilla game; in this case, search for the component that has Mesh in its type (entPhysicalMeshComponent, entMeshComponent, etc...)

  • In the mesh, click on the blue arrow to open the mesh in a new tab (we don't need to add the file)

  • Decisive moment: Open parameters and look for a meshMeshParamPhysics

Have you found it ? Amazing ! It means the mesh has a native collision that we can toggle on. 👍 Let's do this now.

What if there is no meshMeshParamPhysics parameter in the mesh ?

It means that there is no collision with it. But other solutions exist for you:

  • You can create your own collision through Blender (no modding ressource is available at this time)

  • You can fake the collision by using another small entity which already has collision embedded, and hide the small entity inside your item (this technique is a work-around, that does not always fit or give satisfaction, but most of the time it does the job)

  • You can try to find another similar item that has embedded collisions (and go back to the first step of this page)

Activate mesh collisions

Turning it on is pretty simple; we only have 2 things to change, all in the .ent file previously added:

  • Update the filterData and change the values like in the screenshot. Those values determine which entities can collide with, and how to simulate the collision.

This information is not well-researched as of Jan 2024 - if you know anything more about this, please get in touch via Discord or update the wiki!

  • Change the navigationImpact setting to Blocking. (Other values exist; they haven't been documented, but you may have fun with them.)

  • Optional: depending on the item, you may want to enable (or not) lighting-based shadows. You can do so by setting these 3 properties to Always.

Lighting-based shadows comparison

Here is the difference between the values Always and Never

Note: As you can see, Never values will prevent the mesh from casting shadows in the surrounding environment, but your mesh will still handle local shadows cast on itself.

I strongly suggest you to change the .ent name and folder to a custom one, so it doesn't interfere with the rest of the game.

In our test case, I renamed the file as mod\embedded_collision_test\decoration\industrial_table_g.ent.

  • If the path of your ent changed, don't forget to add it to the allPaths.txt file used by Object Spawner.

Once in-game, open and load the new entity with the new path and verify that collision is enabled. 🎉

Last updated