|
|
@ -46,6 +46,8 @@ func _physics_process(delta): |
|
|
|
if has_next && (path.curve.get_point_count() == 0 || follow.get_unit_offset() >= 1.0): |
|
|
|
has_next = false |
|
|
|
path.curve.clear_points() |
|
|
|
if path.curve == null: |
|
|
|
path.curve = Curve3D.new() |
|
|
|
for i in range(buffered_curve.get_point_count()): |
|
|
|
var _pos = buffered_curve.get_point_position(i) |
|
|
|
var _in = buffered_curve.get_point_in(i) |
|
|
@ -61,6 +63,9 @@ func _physics_process(delta): |
|
|
|
if get_road() != null: |
|
|
|
road_index = get_road().get_index() |
|
|
|
|
|
|
|
print(buffered_translate) |
|
|
|
print(buffered_curve.get_baked_length()) |
|
|
|
print(path.curve.get_baked_length()) |
|
|
|
if get_road() != null: |
|
|
|
var road = get_road() |
|
|
|
var penalty_index = road.penalty_index(follow.get_offset(), current_speed) |
|
|
@ -94,18 +99,19 @@ func get_road(): |
|
|
|
return get_race_car().road |
|
|
|
|
|
|
|
func _on_raceCar_road_entered(road): |
|
|
|
print(road.get_name()) |
|
|
|
buffered_curve = road.get_lane_curve(lane) |
|
|
|
print(road.get_name()) |
|
|
|
print(buffered_curve.get_baked_length()) |
|
|
|
|
|
|
|
buffered_rotation_axis = last_rotation_axis |
|
|
|
buffered_rotation_phi = last_rotation_phi |
|
|
|
|
|
|
|
if path.curve.get_point_count() > 0: |
|
|
|
buffered_translate = path.curve.get_point_position(path.curve.get_point_count() - 1) |
|
|
|
buffered_translate = Util.Curve_get_last_point(path.curve) |
|
|
|
|
|
|
|
if road.get_end_rotation_phi() != 0: |
|
|
|
last_rotation_axis = (last_rotation_axis + road.get_end_rotation_axis()).normalized() |
|
|
|
last_rotation_phi = last_rotation_phi + road.get_end_rotation_phi() |
|
|
|
last_rotation_phi += road.get_end_rotation_phi() |
|
|
|
|
|
|
|
has_next = true |
|
|
|
|
|
|
@ -138,7 +144,7 @@ master func reset(): |
|
|
|
if road_before == null: |
|
|
|
road_before = road |
|
|
|
|
|
|
|
buffered_translate = road.get_translation() |
|
|
|
#buffered_translate = road_before.get_curve().get_point_position(road_before.get_curve().get_point_count() - 1) |
|
|
|
last_rotation_axis = road_before.get_rotation().normalized() |
|
|
|
last_rotation_phi = road_before.get_rotation().length() |
|
|
|
|
|
|
|