Add get_closest_point method to Player
This commit is contained in:
parent
1456dacc30
commit
cf13adf1e1
1 changed files with 4 additions and 0 deletions
|
@ -52,6 +52,10 @@ func gravity():
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
self.velocity.y -= GRAVITY
|
self.velocity.y -= GRAVITY
|
||||||
|
|
||||||
|
func get_closest_point(A: Vector3, B: Vector3):
|
||||||
|
var diff = B - A
|
||||||
|
return A - (A.dot(diff) * diff) / (diff.length_squared())
|
||||||
|
|
||||||
remote func walk(direction: Vector2):
|
remote func walk(direction: Vector2):
|
||||||
|
|
||||||
var walkDirectionNormalized = direction.normalized()
|
var walkDirectionNormalized = direction.normalized()
|
||||||
|
|
Reference in a new issue