Add particles
This commit is contained in:
parent
dda4a44386
commit
9435e887a4
11 changed files with 1684 additions and 4826 deletions
|
@ -20,6 +20,10 @@ export default class Body {
|
|||
return [this.x, this.y];
|
||||
}
|
||||
|
||||
get speed() {
|
||||
return Math.sqrt(this.xvel ** 2 + this.yvel ** 2);
|
||||
}
|
||||
|
||||
getWorldPoint(lx, ly) {
|
||||
let [cx, cy] = this.localCom;
|
||||
let [nx, ny] = this.rotateVector(lx - cx, ly - cy, this.r);
|
||||
|
@ -38,6 +42,10 @@ export default class Body {
|
|||
(y * Math.cos(this.r) - x * Math.sin(this.r))];
|
||||
}
|
||||
|
||||
relativeVector(x, y) {
|
||||
return this.rotateVector(x, y, this.r);
|
||||
}
|
||||
|
||||
tickMotion() {
|
||||
this.x += this.xvel;
|
||||
this.y += this.yvel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue