WIP: No idea what exactly i did over those past 2 days

This commit is contained in:
2026-05-11 19:06:06 +02:00
parent f50fc96416
commit 106abd851a
27 changed files with 605 additions and 59 deletions
@@ -0,0 +1,24 @@
import Vector2 from '$lib/vector';
import Rigidbody2D from '../rigidbody/rigidbody2d';
export class AABB {
private size: Vector2 = new Vector2();
private halfSize: Vector2 = new Vector2();
private rigidbody: Rigidbody2D = new Rigidbody2D();
constructor(min?: Vector2, max?: Vector2) {
if (min !== undefined && max !== undefined) this.size = new Vector2(max).sub(min);
this.halfSize = new Vector2(this.size.mul(0.5));
}
public get getMin(): Vector2 {
return new Vector2(this.rigidbody.Position).sub(this.halfSize);
}
public get getMax(): Vector2 {
return new Vector2(this.rigidbody.Position).add(this.halfSize);
}
}
export default AABB;