QUICK DEV TIP #09 UE4 - BLUEPRINTS - COPY COLLISION

This week I wanted to talk copying collision quickly from one static mesh to another within the UE4 engine itself. Most of the time you want simple collision as it is less memory intensive as well as less likely that the player will get stuck on it. So generating collision for your static meshes in engine with simple primitives is great for that.

Generating collision in engine is simple and can be done while in the static mesh editor by going to Collision in the menu bar and selecting the shape that you want to add. You can then tweak the shape with move, rotate and scale editor tools till it fits correctly.

09_CollisionCopy_Blog01.JPG
 

Below is an example of two similar shaped static meshes that I could speed up creating collision for by copying collision across instead of adding and transforming on the second mesh.

09_CollisionCopy_Blog02c.JPG
 

To copy collision first select the static mesh in the content browser, which has the collision that you want to copy.

09_CollisionCopy_Blog03.JPG
 

Next, go to the static mesh viewer view of the object you want to copy the collision to (importantly keeping the content browser selection on the other static mesh). Then go to the collision menu. You will now see the Copy Collision from Selected Static Mesh option is now usable. Clicking on that option will bring the collision across to this object.

09_CollisionCopy_Blog04.JPG
 

This door example above was good for explaining the technique but it has such simplistic collision it wouldn’t take much to recreate the box collision in engine.

Another better example of its use would be in the example below, where I have a more intricate shape which requires multiple collision boxes. The two static meshes are almost identical with the second object having a slightly extended part to it.

09_CollisionCopy_Blog05c.JPG
 

This is a prime example of where it could save you time. The meshes are so similar that I would copy the collision across with the method we previously discussed and then use transform tools to move and scale only one primitive. Far quicker that recreating and transforming all the separate collision primitives again.

09_CollisionCopy_Blog06.JPG
 

If you need a very complex collision or it needs to be very tight fitting to your model, I would suggest looking into importing collision with your model when you export from your 3D program of choice (using secondary meshes with prefixes such as UCX_, see collision section here https://docs.unrealengine.com/en-US/WorkingWithContent/Importing/FBX/StaticMeshes/index.html ).

If you want more tips and tricks make sure to give me a follow on Twitter @cbGameDev

Also, check out the parkour game I'm solo developing called Freerunners. Give it a wishlist if you like the way it looks!: https://store.steampowered.com/app/1430330/Freerunners/