123456789101112131415161718192021222324252627282930313233 |
- extends Spatial
- # Declare member variables here. Examples:
- # var a = 2
- # var b = "text"
- var tileGenScene = preload("res://TileGenerator.tscn")
- # Called when the node enters the scene tree for the first time.
- func _ready():
- for y in range(0,10):
- for x in range(0,5):
- var moontile = tileGenScene.instance()
- moontile.init(y,x)
- #moontile.scale=Vector3(1000,1000,1000)
- $Tiles.add_child(moontile)
- # Called every frame. 'delta' is the elapsed time since the previous frame.
- #func _process(delta):
- # pass
- func latLonToGlobal(latPos, lonPos, offset=Vector3()):
- var height = 1737.4 + offset.z
- var lat = float(latPos+offset.x)*PI/180
- var w = cos(lat)
- var y = sin(lat)
- var u = float(lonPos) / 360
- var lon = float(lonPos+offset.y)*PI/180
- var x = sin(lon)
- var z = cos(lon)
- return Vector3(x * height * w, y*height, z * height * w)
-
|