Math funcs

This commit is contained in:
2025-02-08 11:37:27 +01:00
parent 040a5fa23a
commit adf9a57294
3 changed files with 18 additions and 1 deletions

View File

@@ -162,6 +162,14 @@ move_towards :: (origin: Vector3, target: Vector3, amount: float) -> Vector3 {
return result;
}
move_towards :: (origin: Vector2, target: Vector2, amount: float) -> Vector2 {
result : Vector2;
dir := normalize(target - origin);
result.x = move_towards(origin.x, target.x, abs(dir.x) * amount);
result.y = move_towards(origin.y, target.y, abs(dir.y) * amount);
return result;
}
smooth_damp :: (current: Vector3, target: Vector3, current_velocity: *Vector3, smooth_time: float, max_speed: float, delta_time: float) -> Vector3 {
output_x := 0.0;
output_y := 0.0;
@@ -389,4 +397,4 @@ ease_in_out_sine :: (x: float) -> float {
#import "PCG";
#import "Math";
#load "frustum.jai";
#load "frustum.jai";