# Enable embedded collisions

## Summary

**Published: January 20, 2024 by** [Akiway](https://app.gitbook.com/u/2021vbDrMKZ0TbHeIx2wzPyAYtl2 "mention")\
**Last documented update: January 25, 2024 by** [Akiway](https://app.gitbook.com/u/2021vbDrMKZ0TbHeIx2wzPyAYtl2 "mention")

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**](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/archived-guides/adding-locations-and-structures-with-archivexl).

{% hint style="info" %}
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](https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators-theory/modding-tools/wolvenkit-blender-io-suite "mention"), but the tutorial for this isn't ready yet.
{% endhint %}

### Wait, this is not what I want!

* If you want to create [custom-props](https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators-theory/3d-modelling/custom-props "mention") for AMM, check the corresponding guide. Note that this mechanism applies for them as well!

## Requirements

* [**Wolvenkit 8.12.0+**](https://github.com/WolvenKit/WolvenKit)
* [**Object Spawner 1.5**](https://www.nexusmods.com/cyberpunk2077/mods/2833) *(screenshots say 1.4, but it's the mod title that wasn't updated in 1.5* :smile:*)*
* You know how to [adding-locations-and-structures-with-archivexl](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/archived-guides/adding-locations-and-structures-with-archivexl "mention")
* [allmeshes.archive](https://mega.nz/file/eRREwQbY#L7AWM1eYijyvE7GLo6IK4MQE2ohJci9r9xcq5gk8BXQ) and updated [allpaths ](https://mega.nz/file/WEQxySrS#0QM1rbl1QaUuRdU3RcNEVvYk-rfk_mVVDyg75y8XG40)file created by KeanuWheeze - this will help us to edit new ent files with embedded collisions.
* You need a [Wolvenkit Project](https://app.gitbook.com/s/-MP_ozZVx2gRZUPXkd4r/wolvenkit-app/usage/wolvenkit-projects)

## 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`

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-fa4d383a9346b8664d789d08688d0acd3527a27e%2Fworld_editing__embedded_collision__select.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-ad913f1578049042c6c992d8c7ded1c93d2320f9%2Fworld_editing__embedded_collision__copy_path.png?alt=media" alt=""><figcaption></figcaption></figure>

* Back in WolvenKit, create or open [your project](https://app.gitbook.com/s/-MP_ozZVx2gRZUPXkd4r/wolvenkit-app/usage/wolvenkit-projects)
* Open the [*Asset Browser*](https://app.gitbook.com/s/-MP_ozZVx2gRZUPXkd4r/wolvenkit-app/editor/asset-browser), turn on the [*Mod Browser*](https://app.gitbook.com/s/-MP_ozZVx2gRZUPXkd4r/wolvenkit-app/editor/asset-browser#mod-browser) option, paste the path and add the ent to your project.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-2b272001d7f6b093da08f6bf1f23bc7ed6801528%2Fworld_editing__embedded_collision__mod_browser.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
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.
{% endhint %}

* Open the [.ent file](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/entity-.ent-files#mesh-component-entity-simple-entity) 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 <mark style="color:orange;">entPhysicalMeshComponent</mark> 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 (<mark style="color:orange;">entPhysicalMeshComponent</mark>, <mark style="color:orange;">entMeshComponent</mark>, 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*)

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-c6f6d76697330aef2bca8a7ee710ac2de3a00734%2Fworld_editing__embedded_collision__open_mesh.png?alt=media" alt=""><figcaption></figcaption></figure>

* Decisive moment: Open parameters and look for a <mark style="color:orange;">meshMeshParamPhysics</mark>

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-1916e1976583874b78e275ab384ff7cd7ca2a150%2Fworld_editing__embedded_collision__mesh_physics.png?alt=media" alt=""><figcaption></figcaption></figure>

Have you found it ? Amazing ! It means the mesh has a native collision that we can toggle on. :thumbsup: [Let's do this now.](#activate-the-mesh-collision)

{% hint style="info" %}
**What if there is no&#x20;**<mark style="color:orange;">**meshMeshParamPhysics**</mark>**&#x20;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)
  {% endhint %}

## 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.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-dcfc985a98999fe3df6478dd225cc0e563ebe720%2Fworld_editing__embedded_collision__filter_data.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This information is not well-researched as of Jan 2024 - if you know anything more about this, please get in touch via [Discord](http://discord.gg/redmodding) or update the wiki!
{% endhint %}

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

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-7082bc31bef6f3ce45e8294e9e9937bcfc6de9a9%2Fworld_editing__embedded_collision__navigation_impact.png?alt=media" alt=""><figcaption></figcaption></figure>

* **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`.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-73d097ed6119bfae608f164f63e9a3d768303cc3%2Fworld_editing__embedded_collision__shadows.png?alt=media" alt=""><figcaption></figcaption></figure>

<details>

<summary>Lighting-based shadows comparison</summary>

Here is the difference between the values `Always` and `Never`

<img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-81935e30f5739528cfa40e15f3fc670d0a9a88b3%2Fworld_editing__embedded_collision__shadows_comparison.png?alt=media" alt="" data-size="original">

**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.

</details>

{% hint style="info" %}
I strongly suggest you to change the .ent name and folder to [a custom one](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/items-equipment/moving-and-renaming-in-existing-projects), so it doesn't interfere with the rest of the game.
{% endhint %}

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.

That's it! All you have to do now is to [install your mod and launch the game](https://app.gitbook.com/s/-MP_ozZVx2gRZUPXkd4r/wolvenkit-app/menu/toolbar#install-and-launch).

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

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-539232b79e5a24983e3811a0447b11075fa62d60%2Fworld_editing__embedded_collision__result.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/miscellaneous/enable-embedded-collisions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
