Parcourir la source

play araound with player position

sl@cccfr.de il y a 2 ans
Parent
commit
c08e362486
3 fichiers modifiés avec 12 ajouts et 4 suppressions
  1. 2 2
      Main.gd
  2. 9 1
      Player.gd
  3. 1 1
      Tile.gd

+ 2 - 2
Main.gd

@@ -8,9 +8,9 @@ var tileGenScene = preload("res://TileGenerator.tscn")
 
 
 var minlat = 0
-var maxlat = 10
+var maxlat = 6
 var minlon = 0
-var maxlon = 5
+var maxlon = 3
 
 var curlat = 0
 var curlon = 0

+ 9 - 1
Player.gd

@@ -80,14 +80,22 @@ func _physics_process(delta):
 	vel.z = relativeDir.z * moveSpeed2
 	vel.y = relativeDir.y * moveSpeed2
 	
+	var gravity = self.global_transform.origin.normalized()
 	# move the player
 	vel = move_and_slide(vel, Vector3.UP)
 	#ray = ray.look_at(self.global_transform.origin, Vector3.UP)
 	
 	var pos = self.global_transform.origin
+	var polPos = Common.globalToLatLon(pos.x,pos.y,pos.z)
+	var rotationDeg=get_rotation_degrees().x
+	var posNorm=abs(pos.normalized().y)
+	var targetRot = posNorm * 90
+	#if rotationDeg < targetRot:
+		#rotate_x(1)
+	#elif rotationDeg > targetRot:
+		#rotate_x(-1)
 	
 	.get_parent().get_node("UI/1").text="x:%s y:%s z:%s" %[pos.x, pos.y, pos.z]
-	var polPos = Common.globalToLatLon(pos.x,pos.y,pos.z)
 	.get_parent().get_node("UI/2").text="lat:%s lon:%s" %[polPos.x, polPos.y]
 	#.get_node("UI/3").text="LatLonPos=="+str(latLonToGlobal( self.global_transform.origin.x,self.global_transform.origin.y))
 	

+ 1 - 1
Tile.gd

@@ -11,7 +11,7 @@ var rng = RandomNumberGenerator.new()
 var datafile = "user://sldem2015_512_00n_30n_000_045_float.img"
 var samplesPerLine = 23040
 var lines = 15360
-var offset = 1737.4
+#var offset = 1737.4
 var scaleFact = 1
 
 func init(startLat, startLon):