Medieval Engineers

Medieval Engineers

Modding: Adding Collisions to Your Mods
Steam user Yliroe has graciously agreed to help walk modders through what's necessary to take mods and add the right collision mechanics to them. I've posted this stub here as a placeholder for the conversation. Looking forward to it.
< >
Showing 1-15 of 31 comments
Ayliroé Aug 16, 2016 @ 11:27am 
To start for thoses who don't know there is already a pretty good guide on how to add a model to the game here: http://forum.keenswh.com/threads/modeling-tips.7378764/
It will teach a new modder how to create and convert the necessary files for a visual model readable by the game.
Normally at this point one should have downloaded the Medieval Engineers Mod SDK and have at hand the “ModelBuilder” and “FBX Converter” tools.
Ayliroé Aug 16, 2016 @ 11:28am 
-Installing the necessary tools for the Collision Model-
Remember that all of this is for Blender.
What will follow next is what is the basic installation instructions for this: http://forum.keenswh.com/threads/se-block-tools-for-blender.7285972/ ; it's a tool created by a modder for Space Engineers but it is actually usable for ME, installation instructions are explained in the link but I'll make a short version of them:

You will need these 3 tools:
-Havok Content Tools 2013: https://www.dropbox.com/s/ceww6xaz0ec5mqy/HavokContentTools_2013-1-0_20130717_64Bit_PcXs.exe?dl=0
-FBX Importer: https://github.com/harag-on-steam/fbximporter/releases/tag/havok2013.1-fbx2015.1
-SE Block Tools for Blender: https://github.com/harag-on-steam/se-blender/releases/tag/0.7.0
And also for some reasons you will have to download Space Engineers (you may be able to bypass this)

In order, you have to install the first normally (ignore the plugin boxes in the wizard), then you move the FBXImporter.exe file that you downloaded inside the folder created by the first tool (generally under program files, where the Havok .exes are).
Next, you open Blender, go under File\User Preferences\Add-ons and use the “Install from File” button, then select the SE Block Tools; next you have to activate it (check on top-right corner) and to link 4 paths:
-Game Directory: it needs to be a folder named SpaceEngineers but this will not impact modding (you can probably just make a new folder of the same name if you don’t have the game)
-MWM Builder: link it to the MedievalEngineersModSDK\Tools\MwmBuilder\MwmBuilder.exe file
-FBX Importer: link it to the FBXImporter.exe you have placed in the Havok folder
-Standalone Filter Manager: link it to the same name file also in the Havok folder
Last edited by Ayliroé; Aug 15, 2017 @ 6:34am
Ayliroé Aug 16, 2016 @ 11:28am 
-Creating Collisions for a Block - Long Version-
(you can do all of this in the same .blend file where you have your model):
-First, toggle “Space Engineers Block” under “Scene”, this will show you a bounding box that represents a 2.5x2.5x2.5m space
-The second step is to build a group of objects (has to be different objects, not one with multiple meshes) that are based on primitives (to say basic models with preferably no more than 6-8 faces for each one and no concave shapes). This group as a whole will represent the ingame collision for your block (you can move them to a different layer in Blender by selecting them and tapping M if you need), you should keep them in low numbers (up to 10 is good, I tried with between 11-20 and it worked but you risk to slow the game down the more you add).
Normally none of them should exceed the bounding box and they must all be at 0.01 on all scales, they also need have all of their position and rotation values displayed in Object Mode at 0 (you can see them with N)*. The next thing is pretty important, if you do all your collisions in such a way that they coincide with your model, for some reasons they will be rotated at 180° ingame, so you actually need to counter-rotate them at 180° around the center of the bounding box on the Z axis.
-Open the “Physics” menu, and one by one select each object that will serve as part of the collision and click “Rigid Body”, they will then be outlined in green (rigid body shape should normally be “convex”)
-Verify that all and only the objects that will serve for the collision are present, and they are all outlined in green, then go to “Space Engineers Block” under Scene and:
- -choose an export folder at your wish
- -tap the “+” icon on the right of the Export Setting, it should go from red to grey (don’t do anything else, this simply creates a file that works fine for our needs)
- -Click “Export scene as block” (you can ignore any warning linked to “portable textures”)

You should now end up with a lot of files in your export folder, the only one you need is “Scene_Large.hkt” (you can delete all others). Rename it with the same name as your fbx and xml files and proceed to move them to the “Content” Folder of ME and then build the .mwm with the ModelBuilder tool.

*: A trick if you want to change the position and scale of an object without moving it:
-add a new object like a cube in the scene, resize it at 0.01 and place it at 0 0 0
-edit it and tap S to scale it back to a bigger scale to be able to see it
-return in Object Mode, select first all objects that need a change, select last the new object and tap Ctrl-J, this will merge all of them into one object with the position and scale of the last selected
-edit said object, tap P and select “by loose parts”, this will unmerge all meshes that aren’t connected. Now all your objects are at 0 position, rotation and 0.01 scale
This trick is also useful to do the 180° rotation on Z of all of your collisions (best is to have all of them merged with a 0 0 0 origin, rotate them and unmerge them).
Last edited by Ayliroé; Aug 15, 2017 @ 6:35am
Ayliroé Aug 16, 2016 @ 11:28am 
-Creating Collisions for a Block - Short Version-
-Make a group of objects representing the final collision, must be at 0.01 all scales and at 0 0 0 location/rotation and with maximum dimensions of 2.5m
-rotate all collision objects at 180° on Z around the origin of the scene
-In “Physics” add Rigid Body (convex) to every object used for the collision
-In “Scene” activate “Space Engineers Block”, choose an export folder, push the “+” in settings, choose “export scene as block”, take the Scene_Large.hkt and use it to with the .xml and .fbx (same name all) to make the final .mwm with ModelBuilder
Last edited by Ayliroé; Aug 15, 2017 @ 6:35am
This is absolutely fantastic, thanks so much! I'm looking forward to downloading & installing the files and giving this a try, hopefully tonight.

Will this also create the destruction mechanics at the same time? I know collision is important, but I really want to make sure that all the blocks I put in the game can actually be destroyed too, instead of having projectiles just bounce off them.
Ayliroé Aug 16, 2016 @ 11:48am 
Destruction mechanics works pretty differently, normally you are supposed to open your .mwm file in the tool called "DestructionTool" in the ModSDK, and then use it to create I believe a "SplitPlane" file for your object that directly works ingame (you don't have to manually do the model and collisions of every debris).
But basically right now the tool is broken, you can keep track of the problem here: http://forum.keenswh.com/threads/destruction-tool-doesnt-work.7384588/
Last edited by Ayliroé; Aug 16, 2016 @ 11:50am
Thanks for the link. That's depressing. A huge part of the functionality of the game broken for modders for months! I've asked Marek about it on Twitter, maybe he can help push a fix forward.
Ayliroé Aug 17, 2016 @ 2:28pm 
Just updated for a little thing I found, it's possible to have an object rotated or translated in Object Mode in blender and be imported in its position in the game (fbx files), but that doesn't work with collisions, they seem to go back to 0, so you need to make sure that all of them are at the center of the box. For example you are pretty much obligated to use the trick to replace their origins at 0 (or any other way) when for you do the 180° rotation.
Last edited by Ayliroé; Aug 17, 2016 @ 2:29pm
Hi Yliroe. I've run into a problem. I have downloaded the 3 files, and I've installed the add-on in Blender.
http://i.imgur.com/tmNQMAi.jpg
However, I never get an option for "Space Engineers Block" under "Scene." I even changed the name "Scene" to "BlockPairName" per Harag's post. But the option never shows up.
http://i.imgur.com/X7XHWId.jpg
Could it be because I haven't bought Space Engineers? Will I actually have to buy and install SE in order to make collision models for ME?
Ayliroé Aug 30, 2016 @ 8:13am 
Did you look into the third menu with a sphere and cylinder icon, that's where the "Space Engineers Block" thing will appear, here you are under the first menu which is "Render", not Scene (the name is displayed when you hover on the icon, not what is written below)
Just did it now and was just coming back to delete the post, thank you!
Ayliroé Aug 30, 2016 @ 8:18am 
You don't have to delete it you know, there will probably someone else asking the same question again someday
Yeah, I'm going to keep it up.

And look! It works like a charm.
http://steamcommunity.com/sharedfiles/filedetails/?id=755035952
I dropped that little block of wood dynamically on top of the column. It's just resting on top, but doesn't look "floaty" up above it.

Does this mean that if we have, say, a chest or barrel with an open top, we can set up the collision so that we can put a bunch of items dynamically inside the box?
Ayliroé Aug 30, 2016 @ 9:01am 
Supposedly yes, just like if you make a door
Terrific! I think I'm going to give a chest a try; will be great to have an open chest that we can actually put stuff into and carry around.
< >
Showing 1-15 of 31 comments
Per page: 15 30 50

Date Posted: Aug 16, 2016 @ 9:56am
Posts: 31