How to do collision?

room.jpg

This is my room. It is a static mesh
I want to do collision, really simple. Don’t fall through floor. Don’t walk through walls… For the life of me I cannot find out how to do it.

Obviously none of the standard collision calculations work because the model is concave… So how do I do it?

On my channel you can find a collision tutorial that shows you 3 different ways (atm Im not able to send you a link ;))

Hi

You can create custom collision geometry in your 3D package. The basic workflow is like this:

  1. Create geometry in your DCC package and name it (e.g. “room”)
  2. Copy the geometry (and simplify it if necessary) and name it “UCX_room” (this allows UE to automatically recognize the collision mesh
  3. Select and export both “room” and “UCX_room” using FBX
  4. Import into UE (Important: Unselect “One Convex Hull Per UCX” or you will not be able to enter the concave areas)

To check it: Double-Click the imported mesh to get into the mesh editor then click the collision icon at the top. It should now show correct collision bounds for your concave model.

Alternatively: Create simple elemens (e.g. floor / wall) and combine them in the editor (is more memory efficient too). This way you can use the default collision geometry generators within UE most of the time.

cheers,

I’m not sure if it’s the best way to do it in editor but you could try block volumes… normally however you would make a simple collision mesh in 3ds , blender etc.

Thanks guys, I have something to go with now.

Too bad that I have to work in a 3d program though… since I am only doing prototyping and Blender is not really user friendly.

We have collision! Awesome, thank you!

Or you can simply set Use Complex Collision As Simple which enables per-poly collision. No need to have collision meshes.

://i.imgur/cgA17nx.png

You can always use the BSP brushes within UE for simple prototyping (I’m doing my level blockouts this way) :wink: No need to go to Blender for a setup like the one you’ve shown…

Just remember that this can kill your performance if you have complex meshes…

I can’t use the BSP brushes since I am using Instanced Static meshes for performance reasons.
Also, my level is generated randomly, so to make the blueprint perform ok, good collision on the static mesh is pretty much needed instead of generating that on the fly as well.

As for using the Complex collision as simple, I tried it, but it didn’t seem to work, I will try it again just to see what options are there.

But in the end I will use Blender for making my collisions. This is the “right” way to do it and it also gives me the best performance it seems.

BP generated levels? Cool idea - would be interesting to see what you come up with :slight_smile:

It could look like this.

Keep in mind, this is with my “modelling skills”.

If I could do proper modelling I would make 10 different rooms and connectors.

My blueprint is made so that it places the rooms in a grid, and then fill in connectors. So if you have several different rooms and connectors it would look nothing like a grid.
Also, if you made the a connector that would block instead of connect, it would create a much less linear experience.

Alas, I have no modelling skills, so everything is square and boring.

Overview of the blueprint size.
It works with InstancedStaticMesh, so performance is pretty good as the rooms are handled with very few drawcalls.

Once I get some proper rooms with collision going I will add random spawning of props to the rooms, and in the end… enemies.

1a34d0ea662a5ca11a85a215d498a38a988d9b1a.jpeg

oK…Now I am completely lost.

I have made some new rooms just now. The mesh itself, displays nicely, no problem. But the UCX mesh… for some reason it is HUUUUGE!
It is so big it covers the entire scene, so obviously it doesn’t work.
The bright green and red lines are the collision… What is going on?

df3ae4711a1a668adcff4a6717e3179bc38f2c8c.jpeg

No worries, I get what you mean ! Kudos for the cool idea :slight_smile:

Hmm, a few thoughts:

  • how have you created the collision mesh? Have you made a copy of the original mesh?
  • are these the two only meshes you selected for export? (perhaps you inadevertedly exported another collision mesh)
  • have you made sure “One Conves Hull per UCX” is unchecked? (during import)
  • do you have “combine meshes” enabled? (also during import)

Cheers,

  • I have tried several ways of creating the mesh for collision. I tried with a box to begin with, then a simplified, and in the end just a copy.
  • There are only 2 meshes in my blender file
  • One convex hull per UCX is unchecked
  • I tried both.

My blender file for a room… it has the same problem when exported/imported as the “hallway” i showed earlier

Qhat is the problem with Use Complex Collision As Simple? kill performance in some cases, but for test, it don’t worry many about.

@: Can you PM me the FBX file you’re working with? I can give it a try on my setup…

I sent you a PM

I have just replied with my coordinates :wink: