feat: explicit collision rotation
This commit is contained in:
parent
d55c35ca33
commit
aaa78c99c5
|
@ -237,7 +237,10 @@ export default class Collider extends Component {
|
|||
this.$$aabb = {x0: Infinity, x1: -Infinity, y0: Infinity, y1: -Infinity};
|
||||
this.$$aabbs = [];
|
||||
const {bodies} = this;
|
||||
const {Direction: {direction = 0} = {}} = ecs.get(this.entity) || {};
|
||||
let {Direction: {direction = 0} = {}} = ecs.get(this.entity) || {};
|
||||
if (!this.rotatesCollision) {
|
||||
direction = 0;
|
||||
}
|
||||
for (const body of bodies) {
|
||||
let x0 = Infinity, x1 = -Infinity, y0 = Infinity, y1 = -Infinity;
|
||||
for (const point of transform(body.points, {rotation: direction})) {
|
||||
|
@ -297,5 +300,6 @@ export default class Collider extends Component {
|
|||
collisionEndScript: {type: 'script'},
|
||||
collisionStartScript: {type: 'script'},
|
||||
isColliding: {defaultValue: 1, type: 'uint8'},
|
||||
rotatesCollision: {defaultValue: 1, type: 'uint8'},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ export default function createPlayer(id) {
|
|||
],
|
||||
},
|
||||
],
|
||||
rotatesCollision: 0,
|
||||
},
|
||||
Controlled: {},
|
||||
Direction: {},
|
||||
|
|
Loading…
Reference in New Issue
Block a user