21 lines
496 B
GDScript
21 lines
496 B
GDScript
tool
|
|
extends EditorScenePostImport
|
|
|
|
func post_import(scene):
|
|
var queue = [scene]
|
|
while queue.size() > 0:
|
|
var item = queue.pop_front()
|
|
if item is MeshInstance:
|
|
if item.name == "car_base":
|
|
var shape = item.mesh.create_convex_shape()
|
|
var cs = CollisionShape.new()
|
|
cs.shape = shape
|
|
cs.name = item.name + "_shape"
|
|
scene.add_child(cs)
|
|
cs.owner = scene
|
|
print("generated collision shape")
|
|
break
|
|
for e in item.get_children():
|
|
queue.push_back(e)
|
|
return scene
|