Fix rendering issues

This commit is contained in:
schmelczerandras 2020-08-16 09:15:09 +02:00
parent 56dca9fa60
commit eb39846b75
7 changed files with 25 additions and 29 deletions

View file

@ -43,15 +43,15 @@ export class Character extends GameObject {
const nextPrimitive = this.primitive.clone();
nextPrimitive.center = value;
if (
this.physics
.findIntersecting(nextPrimitive.boundingBox)
.filter((b) => b.value)
.map(
(b) => b.value.distance(nextPrimitive.center) + nextPrimitive.radius
)
.find((d) => d < 0) !== undefined
) {
const intersects = this.physics
.findIntersecting(nextPrimitive.boundingBox)
.filter((b) => b.value)
.map(
(b) => b.value.distance(nextPrimitive.center) + nextPrimitive.radius
);
console.log(intersects);
if (intersects.find((d) => d < 0) !== undefined) {
this.setPosition(value);
}
}