improve runtimeloader for glb files
This commit is contained in:
@@ -35,19 +35,26 @@ func load_gltf(file, parent = self, hasCollision = false, trimesh = false):
|
||||
|
||||
print("Loading ", EXTERNAL_PATH + file)
|
||||
var node = gltf.generate_scene(gltf_state)
|
||||
parent.add_child(node)
|
||||
|
||||
|
||||
var entity_count = 0;
|
||||
if not hasCollision:
|
||||
get_all_entities(node)
|
||||
return node
|
||||
|
||||
for o in get_all_children(node):
|
||||
if o.name.begins_with("entity_") && not o.name.ends_with("_geometry"):
|
||||
print("Loading entity ", o.name)
|
||||
if loadEntity(o):
|
||||
entity_count += 1;
|
||||
elif o is MeshInstance3D:
|
||||
if hasCollision:
|
||||
|
||||
if o is MeshInstance3D:
|
||||
if(trimesh):
|
||||
o.create_trimesh_collision()
|
||||
else:
|
||||
o.create_convex_collision()
|
||||
parent.add_child(node)
|
||||
|
||||
if(entity_count > 0):
|
||||
print("Loaded ", entity_count, " entities.")
|
||||
return node
|
||||
|
||||
Reference in New Issue
Block a user