With a sample scene tree defined like this:
Spatial
+- KinematicBody
+- RigidBody
Something like this (connected to the Spatial
node) should work:
func _ready():
var dist = $KinematicBody.transform.origin.distance_to($RigidBody.transform.origin)
print(dist)
With the KinematicBody
at 0,0,0
and the RigidBody
at (10,10,0)
, that results in a distance of 14.142