feat: Physical
This commit is contained in:
parent
6c26e87840
commit
1098725636
26
packages/entity/traits/physical.js
Normal file
26
packages/entity/traits/physical.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import {compose} from '@avocado/core';
|
||||||
|
import {Vector} from '@avocado/math';
|
||||||
|
import {shapeFromJSON} from '@avocado/physics';
|
||||||
|
|
||||||
|
import {simpleState, Trait} from '../trait';
|
||||||
|
|
||||||
|
const decorate = compose(
|
||||||
|
);
|
||||||
|
|
||||||
|
export class Physical extends decorate(Trait) {
|
||||||
|
|
||||||
|
static defaultParams() {
|
||||||
|
return {
|
||||||
|
shape: undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
initialize() {
|
||||||
|
this._shape = shapeFromJSON(this.params.get('shape'));
|
||||||
|
}
|
||||||
|
|
||||||
|
get shape() {
|
||||||
|
return this._shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user