Godot Version
4.6.2
Question
I am very lost on Vector math. I have tried to learn it but I just don’t understand it. The reason this arises is I am trying to make a camera nodes FOV increase with a curve based on the MPH of the car. I have no idea how I would normalize. So. I can sample a curve.
class_name CarComponent
extends Node
@export var car : VehicleBody3D
@export var speed := 100.0
@export var turn_amount := 0.3
var move_dir := Vector2.ZERO
func car_update(delta: float):
car.engine_force = speed * move_dir.y
car.steering = move_toward(car.steering, (turn_amount * move_dir.x), delta)
func get_mph() -> float:
var mps = car.linear_velocity.length()
var mph = mps * 2.237
return mph
class_name CameraComponent
extends Camera3D
@export var fov_curve : Curve
var mph := 0.0
The camera component has much less as I am struggling a lot on the math.