Thanks to gb and Spike, I'd like to post a mini tutorial with images, from start to finish, on how to use mesh collision in FTEQW engine.
This guide is for Blender users but I think that any 3d apps with a decent Wavefront OBJ's exporting plugin should be fine. A dilemma would be, of course, materials naming, model axis orientation and exporting options.
1) Create 1 or more models which will be our visible model(s) and a surrounding object which will be our collision model.
For Blender users, visible object(s) material(s) name should be
Code: Select all
textures/materialfolder/materialname
for example:
Multiple materials on same objects and multiple materials on multiple separated objects are both valid in Blender.
!
IMPORTANT: remember to unwrap both visible and collision meshes, even if applied material doesn't need UVs. Otherwise models could not be displayed!
The material name of the collision mesh will be:
If you need smoothed objects you need to detail mesh near borders with edge loops or weird light / shadows artifacts will occur in FTEQW. In Blender Crtl + R command.
For Blender users I shared
this example file.
2) Select both visible object(s) and collision mesh and export it.
For Blender users, these are correct exporting values. Important values are Selection Only (to avoid to export unnecessary objects) and Apply modifiers (so a Subdivion surface modifier don't need to be applied to the mesh before exporting)
Vital values are:
- Include UVs (without texture UV's, collision meshes could not work)
- Write Materials (without this, shaders won't be applied ingame)
- Objects as OBJs Groups (Important! With multiple objects / materials
THIS is the one to check,
instead of Objects as OBJ Objects)
IMPORTANT: For Blender users remember to switch
Otherwise your model will be rotated ingame
3) Create in yourgamename/yourdatafolder/scripts a text file named
custinfoparms.txt edited like this
4) Edit yourgamename/yourdatafolder/scripts/common.shader (If you don't have it search for common-spog.pk3 on the net) adding this shader for collision mesh
5) Add
-custinfoparms in your map editor build xml file. For example, this is default_build_menu.xml in NetRadiant mygame.game folder:
Code: Select all
<build name="q3map 32bit with collisions and no light">
<command>[q3map2_32bit] -custinfoparms -meta -v "[MapFile]"</command>
<command>[q3map2_32bit] -vis -saveprt "[MapFile]"</command>
</build>
Add in your editor a misc_model entity and select your obj file previously exported.
IMPORTANT! NetRadiant 32bit (64bit version I don't know, didn't test it) imports and displays flawlessy objs exported as earlier explained. GTKRadiant (1.6.4) yells this error.
Code: Select all
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName
And visible and collision model are not seen ingame.
This image is from NetRadiant
I hope this mini tutorial will be helpful to someone, cheers!