use of ilargia.egdx.logicbricks.component.game.RigidBody in project Entitas-Java by Rubentxu.
the class PointerOverSensorSystem method isOver.
private boolean isOver(PointerOverSensor sensor, int pointer) {
PointerState<Vector2, Vector3> touchState = inputManager.getTouchState(pointer);
if (touchState.down) {
Set<GameEntity> targets = Indexed.getTagEntities(sensor.targetTag);
for (GameEntity target : targets) {
TextureView view = target.getTextureView();
RigidBody rigidBody = target.getRigidBody();
if (view != null && rigidBody != null) {
testRectangle.setPosition(rigidBody.body.getPosition().x, rigidBody.body.getPosition().y);
testRectangle.setSize(view.bounds.extentsX * 2, view.bounds.extentsY * 2);
return testRectangle.contains(touchState.coordinates.x, touchState.coordinates.y);
}
}
}
return false;
}
Aggregations