mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-28 08:30:08 +07:00
Fix for shoving NPCs
This commit is contained in:
parent
2e264abb66
commit
354c715261
@ -4,6 +4,7 @@ import com.badlogic.ashley.core.ComponentMapper;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.Family;
|
||||
import com.badlogic.ashley.systems.IteratingSystem;
|
||||
import com.badlogic.gdx.physics.box2d.BodyDef;
|
||||
import com.riiablo.engine.component.Box2DComponent;
|
||||
import com.riiablo.engine.component.VelocityComponent;
|
||||
|
||||
@ -20,5 +21,12 @@ public class Box2DBodySystem extends IteratingSystem {
|
||||
VelocityComponent velocityComponent = this.velocityComponent.get(entity);
|
||||
Box2DComponent box2DComponent = this.box2DComponent.get(entity);
|
||||
box2DComponent.body.setLinearVelocity(velocityComponent.velocity);
|
||||
|
||||
// FIXME: This is a temp fix to prevent shoving NPCs -- need to explore Contact Filters
|
||||
if (velocityComponent.velocity.isZero()) {
|
||||
box2DComponent.body.setType(BodyDef.BodyType.StaticBody);
|
||||
} else {
|
||||
box2DComponent.body.setType(BodyDef.BodyType.DynamicBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user