- Edited
I try to predict the time a rigid body ball needs to travel a given distance. Custom integrator is enabled. So the velocity stays constant through the travel.
I expected the distance between the ball start position, and the ball position after one second, is exactly the same than the linear_velocity length.
extends Node2D
var startPos:Vector2
func _ready():
startPos = $Ball.position
$Ball.linear_velocity = Vector2(0.0, 500.0)
$Timer.start()
func _on_Timer_timeout():
$Label.text = "Traveled " + str(($Ball.position - startPos).length()) + " \nVel " + str($Ball.linear_velocity)
get_tree().set_pause(true)
The result is 491 for the travelled distance. Is linear_velocity intended to represent the vector traveled in one second ? If so I would expect the result as 500.