the-world-engine
Version:
three.js based, unity like game engine for browser
46 lines (45 loc) • 839 B
JavaScript
import { Vector2 } from "three/src/Three";
export class RaycastHit2D {
wr=new Vector2;
pi=null;
Dr=0;
Hr=0;
mr=new Vector2;
gr=new Vector2;
Ci=null;
Nt=null;
setData(t, r, e, i, n, s, _, a) {
this.wr.set(t.x, t.y);
this.pi = r;
this.Dr = e;
this.Hr = i;
this.mr.set(n.x, n.y);
this.gr.set(s.x, s.y);
this.Ci = _;
this.Nt = a;
}
get centroid() {
return this.wr;
}
get collider() {
return this.pi;
}
get distance() {
return this.Dr;
}
get fraction() {
return this.Hr;
}
get normal() {
return this.mr;
}
get point() {
return this.gr;
}
get rigidbody() {
return this.Ci;
}
get transform() {
return this.Nt;
}
}