extends Spatial


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var apoapsis = 17000
export var periapsis = 12000
export var aoa = 42
export var xtilt = 0
export var ytilt = 0
export var daylen = 6
var orbital_period
var planet
var count
# Called when the node enters the scene tree for the first time.
func _ready():
	planet = get_child(0)
	self.rotate_y(aoa)
	self.rotate_x(xtilt)
	self.rotate_z(ytilt)
	planet.translation = Vector3(0,0,apoapsis)
	var a = (apoapsis + periapsis ) * 1000000.0 / 2
	orbital_period = 2*PI*sqrt(a*a*a/(132700000000000000000.0))
	print(orbital_period)
	count = 0
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass
# warning-ignore:unused_argument
func _physics_process(delta):
	count += 1
	if(count % 60 == 0):
		self.rotate_y(2*PI/(orbital_period))
	pass
