torque
This commit is contained in:
parent
b003aec5a4
commit
1197618572
@ -74,10 +74,11 @@ func handle_input(_delta: float):
|
|||||||
# Apply torque for turning
|
# Apply torque for turning
|
||||||
if turn_input != 0:
|
if turn_input != 0:
|
||||||
var torque = Vector3.UP * turn_input * base_turn_speed
|
var torque = Vector3.UP * turn_input * base_turn_speed
|
||||||
|
apply_torque(torque)
|
||||||
|
|
||||||
# Clamp the torque to the maximum turn speed
|
# Clamp the angular velocity to the maximum turn speed
|
||||||
var clamped_torque = clamp(torque, Vector3(-max_turn_speed, -max_turn_speed, -max_turn_speed), Vector3(max_turn_speed, max_turn_speed, max_turn_speed))
|
if angular_velocity.length() > max_turn_speed:
|
||||||
apply_torque(clamped_torque)
|
angular_velocity = angular_velocity.normalized() * max_turn_speed
|
||||||
|
|
||||||
|
|
||||||
# Apply force for forward and backward movement
|
# Apply force for forward and backward movement
|
||||||
|
Loading…
Reference in New Issue
Block a user