Fixed bug in offset calculation
This commit is contained in:
parent
8f2a1146f0
commit
8786d30936
1 changed files with 3 additions and 3 deletions
|
|
@ -52,8 +52,8 @@ func get_world_position (location: Vector2, offset: Vector2 = Vector2.ZERO) -> V
|
|||
return height * Vector2.from_angle(angle)
|
||||
|
||||
func get_location_from_world_pos(pos : Vector2):
|
||||
var angle = pos.angle()
|
||||
var x = floor(num_collumns * fposmod(angle, TAU) / TAU)
|
||||
var angle = fposmod(pos.angle(), TAU)
|
||||
var x = floor(num_collumns * angle / TAU)
|
||||
var height = pos.length()
|
||||
var y = ceil((height - ground_radius)/cell_height)
|
||||
return Vector2(x, y)
|
||||
|
|
@ -62,7 +62,7 @@ func get_offset_from_world_pos(pos : Vector2):
|
|||
var angle = pos.angle()
|
||||
var x = fposmod(num_collumns * angle / TAU, 1) * cell_height
|
||||
var height = pos.length()
|
||||
var y = fposmod((height - ground_radius)/cell_height, 1) * cell_height
|
||||
var y = fposmod(-(height - ground_radius)/cell_height, 1) * cell_height
|
||||
return Vector2(x, y)
|
||||
|
||||
func reset():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue