1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

A Guide for Collisions Models

Discussion in 'Modding' started by Yliroe, Apr 8, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Yliroe

    Yliroe Trainee Engineer

    Hello guys,
    Some time ago I made a guide of the method I used to mod collision models in Medieval Engineers, mostly because I saw a modder who wasn't able to find such information easily. Since it was posted on a steam discussion linked only from one place it might have not received enough attention, so I'm reposting it here.
    It might be outdated on some parts, but I hope it will complement well the other guides present on the forum.
    (The original thread: https://steamcommunity.com/app/333950/discussions/0/360672383121071462/ )

    The Guide (this is a text-only guide):
    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: https://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.

    -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: https://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 (this is not a company provided download): 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

    -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 slowing 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 to 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).

    -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: Aug 15, 2017
    • Like Like x 1
  2. Concomitant

    Concomitant Trainee Engineer

    Thank you for making this! Got a collision model up now for my Round Bartizan mod!
  3. Yliroe

    Yliroe Trainee Engineer

    I just found solutions to 2 big issues I encountered while modding, and since they seem to lack coverage on the internet I'm going to answer them here:

    If your modded object displays with an incorrect lighting ingame (as if the faces are lit from the inside) even though the normals are correct, and you want to fix it without starting over:
    - In Blender, merge the bugged object with an unbugged one (generally by appending it) in object mode while having selected the unbugged last (the unbugged need to have a working material, so not be a new generic mesh), remove it (by unmerging and removing it, or deleting all the faces), remove the unnecessarily-added material (keep the original one).
    - If the object is very dark but textured after doing this, retry with another unbugged object.
    - If this doesn’t work or degrades the lighting of the object, there is only one other fix which is to change the faces shading to “flat”, which degrades the visual result of the edges seams but removes lighting issues completely.

    If you want a modded block to behave like a specific vanilla one when compounding:

    - Open the model you want to change in Blender.
    - Import the fbx of a vanilla object with the compounding behavior you want.
    - Select all the "plain axes" (the black origins called “Compound_XX” that are parented inside the model you imported), and under “Object” then "Relations" re-parent them to your object.
    - Remove the unneeded vanilla model
    - Export the result as usual, while having selected the models and all the locators beforehand.
    Imported "plain-axes" tend to move after re-parenting, so do it before moving them to fix their position. If they move in a wrong location, it might be due to the new parent block not being at 0-0-0 position.

    The game seems to treat each "plain axes" as a volume of which each axe end is an end (since pillars can merge with a cube). They can be handcrafted, rotated, scaled, translated in any way, as long as they are a child of the model and are named "compound_[2-3 digits number]". The game then seems to calculate if 2 objects to be compounded have intersecting volumes, but only calculates inside one block space so if a "plain axes" extends out of the 2.5m space (if using large blocks) it doesn't affect other blocks.
    Last edited: Sep 21, 2017
Thread Status:
This last post in this thread was made more than 31 days old.