Avoid warning.

This commit is contained in:
Relintai 2023-01-13 23:10:06 +01:00
parent 02caaf685a
commit 98e4718c98
6 changed files with 6 additions and 6 deletions

View File

@ -77,7 +77,7 @@ func _calculate_linear_velocity(
var velocity := current_velocity + facing_direction * actual_strength * delta var velocity := current_velocity + facing_direction * actual_strength * delta
velocity = velocity.linear_interpolate(Vector2.ZERO, ship_drag_coefficient) velocity = velocity.linear_interpolate(Vector2.ZERO, ship_drag_coefficient)
return velocity.clamped(speed_max) return velocity.limit_length(speed_max)
func _get_movement() -> Vector2: func _get_movement() -> Vector2:

View File

@ -41,7 +41,7 @@ func _physics_process(delta: float) -> void:
GSAIUtils.to_vector2(agent.linear_velocity) GSAIUtils.to_vector2(agent.linear_velocity)
+ (GSAIUtils.angle_to_vector2(rotation) * -agent.linear_acceleration_max * delta) + (GSAIUtils.angle_to_vector2(rotation) * -agent.linear_acceleration_max * delta)
) )
linear_velocity = linear_velocity.clamped(agent.linear_speed_max) linear_velocity = linear_velocity.limit_length(agent.linear_speed_max)
linear_velocity = linear_velocity.linear_interpolate(Vector2.ZERO, _linear_drag_coefficient) linear_velocity = linear_velocity.linear_interpolate(Vector2.ZERO, _linear_drag_coefficient)
linear_velocity = move_and_slide(linear_velocity) linear_velocity = move_and_slide(linear_velocity)

View File

@ -146,7 +146,7 @@ func _physics_process(delta: float) -> void:
# We add the discovered acceleration to our linear velocity. The toolkit does not limit # We add the discovered acceleration to our linear velocity. The toolkit does not limit
# velocity, just acceleration, so we clamp the result ourselves here. # velocity, just acceleration, so we clamp the result ourselves here.
velocity = (velocity + Vector2(acceleration.linear.x, acceleration.linear.y) * delta).clamped( velocity = (velocity + Vector2(acceleration.linear.x, acceleration.linear.y) * delta).limit_length(
agent.linear_speed_max agent.linear_speed_max
) )

View File

@ -48,7 +48,7 @@ func _physics_process(delta: float) -> void:
direction = GSAIUtils.angle_to_vector2(rotation) direction = GSAIUtils.angle_to_vector2(rotation)
velocity += direction * acceleration_max * movement * delta velocity += direction * acceleration_max * movement * delta
velocity = velocity.clamped(speed_max) velocity = velocity.limit_length(speed_max)
velocity = velocity.linear_interpolate(Vector2.ZERO, 0.1) velocity = velocity.linear_interpolate(Vector2.ZERO, 0.1)
velocity = move_and_slide(velocity) velocity = move_and_slide(velocity)

View File

@ -53,7 +53,7 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
if !_body.is_inside_tree() or _body.get_tree().paused: if !_body.is_inside_tree() or _body.get_tree().paused:
return return
var velocity : Vector2 = GSAIUtils.to_vector2(linear_velocity + accel * delta).clamped(linear_speed_max) var velocity : Vector2 = GSAIUtils.to_vector2(linear_velocity + accel * delta).limit_length(linear_speed_max)
if apply_linear_drag: if apply_linear_drag:
velocity = velocity.linear_interpolate(Vector2.ZERO, linear_drag_percentage) velocity = velocity.linear_interpolate(Vector2.ZERO, linear_drag_percentage)

View File

@ -162,7 +162,7 @@ window/stretch/aspect="expand"
[editor_plugins] [editor_plugins]
enabled=PoolStringArray( "res://addons/gdc_converter/plugin.cfg" ) enabled=PoolStringArray( )
[input] [input]