Improved traffic system

This commit is contained in:
Segey Lapin
2021-11-07 06:24:30 +03:00
parent aae5d0a8c3
commit ee1250d5d2
5 changed files with 53 additions and 287 deletions

View File

@@ -19,8 +19,9 @@ func _process(delta):
var xt = $VehicleBody.global_transform.affine_inverse()
var loc = xt.xform(tgt)
$VehicleBody.steering = clamp(loc.x, -1, 1)
print(loc.x, " ", loc.z)
print(loc.x, " ", loc.z, $VehicleBody.linear_velocity)
$Camera.look_at($VehicleBody.global_transform.origin, Vector3.UP)
print($VehicleBody.linear_velocity)
match state:
0:
$VehicleBody.engine_force = 2000