Created
February 26, 2019 08:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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