Math funcs
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user