Start.gd 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. extends Node
  2. onready var fps_label = get_node("Status/FPS")
  3. onready var debug_label = get_node("Status/Debug")
  4. onready var car = get_node("Monteri")
  5. onready var fl_wheel_controller = get_node("Monteri/FL")
  6. onready var fr_wheel_controller = get_node("Monteri/FR")
  7. onready var rl_wheel_controller = get_node("Monteri/RL")
  8. onready var rr_wheel_controller = get_node("Monteri/RR")
  9. func _process(_delta):
  10. if Input.is_action_just_released("ui_cancel"):
  11. get_tree().quit()
  12. var fps = Performance.get_monitor(Performance.TIME_FPS)
  13. var speed: float = car.linear_velocity.length()
  14. var acceleration: float = car.acceleration_measurement
  15. var force_ratio: float = car.get_acceleration_force_relative()
  16. var velocity_rear_axis: float = car.get_velocity_rear_axis()
  17. var turn_radius: float = car.get_turn_radius(speed)
  18. var grip: bool = car.get_grip()
  19. var grip_force: float = car.get_grip_force()
  20. var omega_reference = car.get_omega_reference()
  21. var omega_measurement = car.angular_velocity.y
  22. var format = "FPS: %2.0f"
  23. var fl_force: Vector3 = fl_wheel_controller.get_force()
  24. var fl_offset: Vector3 = fl_wheel_controller.get_offset()
  25. var fr_force: Vector3 = fr_wheel_controller.get_force()
  26. var fr_offset: Vector3 = fr_wheel_controller.get_offset()
  27. var rl_force: Vector3 = rl_wheel_controller.get_force()
  28. var rl_offset: Vector3 = rl_wheel_controller.get_offset()
  29. var rr_force: Vector3 = rr_wheel_controller.get_force()
  30. var rr_offset: Vector3 = rr_wheel_controller.get_offset()
  31. fps_label.text = format % fps
  32. format = "Speed: %.0f m/s (Acceleration: %.1f)\n"
  33. format += "Force Ratio: %.2f\n"
  34. format += "Velocity Rear: %.0f m/s\n\n"
  35. format += "Grip: %s\n"
  36. format += "Grip Force: %.1f N\n\n"
  37. format += "Omega: %.1f (ref: %.1f)\n"
  38. format += "Turn Radius: %.0f m\n\n"
  39. format += "FL force: %.1f N\nFL offset: (%.1f %.1f %.1f)\n\n"
  40. format += "FR force: %.1f N\nFR offset: (%.1f %.1f %.1f)\n\n"
  41. format += "RL force: %.1f N\nRL offset: (%.1f %.1f %.1f)\n\n"
  42. format += "RR force: %.1f N\nRR offset: (%.1f %.1f %.1f)\n\n"
  43. debug_label.text = format % [speed, acceleration, force_ratio, velocity_rear_axis, grip, grip_force, omega_measurement, omega_reference, turn_radius, fl_force.y, fl_offset.x, fl_offset.y, fl_offset.z, fr_force.y, fr_offset.x, fr_offset.y, fr_offset.z, rl_force.y, rl_offset.x, rl_offset.y, rl_offset.z, rr_force.y, rr_offset.x, rr_offset.y, rr_offset.z]