mirror of
https://github.com/FOSS-Supremacy/OpenLiberty.git
synced 2025-04-28 20:07:57 +03:00
fix: checking if the car is reversing.
This commit is contained in:
parent
2a8dcbceef
commit
fbb70032cb
1 changed files with 6 additions and 4 deletions
|
@ -46,7 +46,6 @@ func _process(delta):
|
||||||
|
|
||||||
if not FreeCamera:
|
if not FreeCamera:
|
||||||
if is_reversing(): # If you are reversing, the camera rotates in reverse, prioritizing the front of the car.
|
if is_reversing(): # If you are reversing, the camera rotates in reverse, prioritizing the front of the car.
|
||||||
# <-- Desativado por motivos de bugs muito estranhos --> NÂO TIRE O COMENTARIO DESSA BOMBA
|
|
||||||
target_rotation = reverse_rotation
|
target_rotation = reverse_rotation
|
||||||
car_is_moving = true
|
car_is_moving = true
|
||||||
elif Vehicle.linear_velocity.length() > 2: # If you are going forward, the camera prioritizes the rear of the car.
|
elif Vehicle.linear_velocity.length() > 2: # If you are going forward, the camera prioritizes the rear of the car.
|
||||||
|
@ -73,8 +72,11 @@ func _process(delta):
|
||||||
# Checks if the car is reversing.
|
# Checks if the car is reversing.
|
||||||
# Still doesn't work very well.
|
# Still doesn't work very well.
|
||||||
func is_reversing() -> bool:
|
func is_reversing() -> bool:
|
||||||
var test = Vehicle.linear_velocity.dot(Vehicle.global_transform.basis.z)
|
if Vehicle.linear_velocity.length() > 2:
|
||||||
if test < 0:
|
var test = Vehicle.linear_velocity.dot(Vehicle.global_transform.basis.z)
|
||||||
return true
|
if test < 0:
|
||||||
|
return true
|
||||||
|
else:
|
||||||
|
return false
|
||||||
else:
|
else:
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue