Add isZero getter to Vec2 and Vec3

This commit is contained in:
Holly Stubbs 2023-11-05 10:56:28 +00:00
parent 8fc6836b29
commit 81b5fb302d
Signed by: tgpholly
GPG Key ID: B8583C4B7D18119E
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,10 @@ export class Vec2 {
}
}
public get isZero() {
return this.x === 0 && this.y === 0;
}
public set(x?:Vec2 | number, y?:number) {
if (x instanceof Vec2) {
this.x = x.x;

View File

@ -21,6 +21,10 @@ export class Vec3 {
}
}
public get isZero() {
return this.x === 0 && this.y === 0 && this.z === 0;
}
public set(x?:Vec3 | number, y?:number, z?:number) {
if (x instanceof Vec3) {
this.x = x.x;