clamp
This commit is contained in:
parent
2e5428ae91
commit
c3285652ea
@ -74,7 +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_length(max_turn_speed))
|
var clamped_torque = Vector3(
|
||||||
|
torque.x.clamp(-max_turn_speed, max_turn_speed),
|
||||||
|
torque.y.clamp(-max_turn_speed, max_turn_speed),
|
||||||
|
torque.z.clamp(-max_turn_speed, max_turn_speed))
|
||||||
|
apply_torque(clamped_torque)
|
||||||
|
|
||||||
|
|
||||||
# Apply force for forward and backward movement
|
# Apply force for forward and backward movement
|
||||||
|
Loading…
Reference in New Issue
Block a user