Beginnings of a force-directed layout

This commit is contained in:
Sebastian Morr 2020-03-18 16:42:19 +01:00
parent f8c05fffb1
commit 0059b7b196
2 changed files with 8 additions and 2 deletions

View File

@ -40,7 +40,7 @@ func git(args, splitlines = false):
var output = []
var a = args.split(" ")
a.insert(0, "-C")
a.insert(1, "/home/seb/tmp/godotgit")
a.insert(1, "/home/seb/wip/wurst-day-ever")
#print ("Running: ", a)
OS.execute("git", a, true, output, true)
var o = output[0]

View File

@ -12,7 +12,13 @@ func _ready():
pass
func _process(delta):
pass
for c in children:
var other = get_node("..").objects[c]
var d = other.position.distance_to(position)
var dir = (other.position - position).normalized()
var f = ((d-400)*0.01)
position += dir*f
other.position -= dir*f
func id_set(new_id):
id = new_id