building_segment.gd 621 B

123456789101112131415161718192021222324252627
  1. extends Spatial
  2. var mat
  3. var color = ColorN("brown")
  4. var power = 3.0
  5. # Declare member variables here. Examples:
  6. # var a = 2
  7. # var b = "text"
  8. func prepare_material():
  9. mat = SpatialMaterial.new()
  10. mat.emission_enabled=true
  11. mat.emission_energy = power
  12. mat.emission = color
  13. mat.albedo_color = ColorN("black")
  14. # Called when the node enters the scene tree for the first time.
  15. func _ready():
  16. randomize()
  17. prepare_material()
  18. var m = MeshInstance.new()
  19. m.mesh = CubeMesh.new()
  20. m.mesh.size = Vector3(1,1,1)
  21. m.scale = Vector3(2.0,4.0,1)
  22. m.translation = Vector3(-1.5,2.5,-2.5)
  23. m.set_surface_material(0,mat)
  24. add_child(m)