Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions addons/godotvmf/godotmdl/mdl_combiner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,8 @@ func generate_collision():

var static_body: StaticBody3D = StaticBody3D.new();
var collision: CollisionShape3D = CollisionShape3D.new();
var shape: ConvexPolygonShape3D = ConvexPolygonShape3D.new();

# FIXME: Use ConvexPolygonShape3D instead of ConcavePolygonShape3D
# but if it used then for some models it triggers an error
# "Failed to build convex hull godot"
var shape: ConcavePolygonShape3D = ConcavePolygonShape3D.new();

collision.shape = shape;
collision.name = "collision_" + str(surface_index) + "_" + str(solid_index);
static_body.name = "solid_" + str(surface_index) + "_" + str(solid_index);
static_body.basis *= additional_basis;
Expand All @@ -184,7 +179,9 @@ func generate_collision():

vertices.append_array([v1, v2, v3]);

collision.shape.set_faces(PackedVector3Array(vertices));
shape.points = PackedVector3Array(vertices);
collision.shape = shape;

if skeleton and skeleton.find_bone("static_body") == -1:
var bone_attachment: BoneAttachment3D = BoneAttachment3D.new();
bone_attachment.name = "bone_attachment_" + str(surface_index) + "_" + str(solid_index);
Expand Down
2 changes: 1 addition & 1 deletion addons/godotvmf/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="GodotVMF"
description="Allows use VMF files in Godot"
author="H2xDev"
version="2.2.8"
version="2.2.9"
script="godotvmf.gd"
6 changes: 5 additions & 1 deletion addons/godotvmf/src/vmf_config.gd
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ class ImportConfig:
## If specified, the importer will use this preset for the navigation mesh
var navigation_mesh_preset: String = ProjectSettings.get_setting("godot_vmf/import/navigation_mesh_preset", "");

static var gameinfo_path: String = ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://");
var gameinfo_path: String = ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://");

## NOTE: Support previous version of this config where this field wasn't a part of ImportConfig
static var gameinfo_path: String:
get: return ProjectSettings.get_setting("godot_vmf/import/gameinfo_path", "res://");

static var models: ModelsConfig:
get:
Expand Down
8 changes: 4 additions & 4 deletions addons/godotvmf/src/vmf_resource_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ static func for_resource_import() -> void:
## Returns true if any resources were imported
static func import_models(vmf_structure: VMFStructure) -> bool:
if not VMFConfig.models.import: return false;
if not "entity" in vmf_structure: return false;
if vmf_structure.entities.size() == 0: return false;

for entity in vmf_structure.entity:
if not "model" in entity: continue;
for entity in vmf_structure.entities:
if not "model" in entity.data: continue;
if entity.classname != "prop_static": continue;

var model_path = entity.get("model", "").to_lower().get_basename();
var model_path = entity.data.get("model", "").to_lower().get_basename();
if not model_path: continue;

var mdl_path = VMFUtils.normalize_path(VMFConfig.gameinfo_path + "/" + model_path + ".mdl");
Expand Down
Loading