Advertisement
Guest User

Godot Multimash

a guest
Jan 10th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. #Your mesh
  2. var cubeMash = load("res://cubes/testcube.msh")
  3.  
  4. #probably needs to be a global var, cant add to tree
  5. var cubeMultimash = MultiMesh.new()
  6. cubeMultimash.set_mesh(cubeMash)
  7. #First vector is the standard position of new MeshInstances
  8. #Second vector is the size of new MeshInstances
  9. cubeMultimash.set_aabb(AABB(Vector3(0,0,0),Vector3(2,2,2)))
  10. #Couldnt get #cubeMultimash.generate_aabb() to work
  11. var cubeMeshInstance = MultiMeshInstance.new()
  12. cubeMesh.set_multimesh(cubeMultimash)
  13. cubeMultimash.set_instance_count(1)
  14. #set new position
  15. cubeMesh.translate(Vector3(0,2,0))
  16. #add new mesh to tree so it doesnt get cleaned up
  17. add_child(cubeMesh)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement