Skip to content

Instantly share code, notes, and snippets.

@Einlander
Created February 26, 2019 08:17
Show Gist options
  • Save Einlander/5e2e1a249ab724c98bd511f1b54e0b82 to your computer and use it in GitHub Desktop.
Save Einlander/5e2e1a249ab724c98bd511f1b54e0b82 to your computer and use it in GitHub Desktop.
Simple Godot script to generate Trimesh Collisions on a node and all it's children
#Simple script to generate Trimesh Collisions on a node and all it's children
extends Node
var collision_body = StaticBody.new()
var collision_shape = CollisionShape.new()
func _ready():
walk_nodes(self)
func walk_nodes(root_node):
if root_node is MeshInstance:
root_node.create_trimesh_collision()
var node_children = root_node.get_children()
for child in node_children:
walk_nodes(child)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment