-
-
Notifications
You must be signed in to change notification settings - Fork 14
Import map
- Create a scene and add a new node of type
VMFNode. - Choose a VMF file to import. Enable the "Use External File" checkbox if you need to browse for a file outside of the Godot resources.
- Click
Importin the inspector panel or clickFullin the 3D scene view toolbar. - Wait a while...
- Done!
If you find that something is going wrong, check the Output panel first.
In some cases, you will see messages tagged with [Godot VMF] in the Output panel.
The "Resource Generation" properties in VMFNode control whether the generated meshes or collision shapes are stored as binary resources inside the project directory (configured via import.geometry_folder).
This helps with scene file size and complexity, and improves editor load times.
The collision of the imported map is separated by surface properties. This is needed if you want to add different footstep sounds for each surface type, for example. Each StaticBody3D has a surface_prop field defined in the metadata that you can read via raycasting.
Important
Add a $surfaceprop field into the VMT or surfaceprop into the metadata section of a Godot material before importing a map.
Some materials can have compile properties starting with % (%compilenodraw, %compileclip, and so on). You can modify the import behavior by adding a global singleton called VMFExtendGeometryCorrector in @tool mode.
@tool
extends Node
# All faces with this compile property will be ignored.
const norender = [
'compileclip',
'compilenodraw',
'compilesky',
'npcclip',
'compileplayerclip',
'compilenpcclip',
];
# Collision for material that has this compile property will be removed
const nocollision = [
'compilesky',
];
## Modify solid node that has compileplayerclip property
func compileplayerclip(solid: StaticBody3D):
solid.collision_layer = 1 << 1
solid.collision_mask = 1 << 1
func compilenpcclip(solid: StaticBody3D):
solid.collision_layer = 1 << 2
solid.collision_mask = 1 << 2