/** * Transform this AABB into a new AABB with the given rotation, offset and scale as represented by the {@link Transform}. * * @param transform The {@link Transform} representing the offset, rotation, and scale transformation from this AABB to the new AABB. * @return the new transformed AABB. */ public AABB transform(Transform transform) { return transform(transform, DEFAULT_MARGIN); }
/** * Transform this AABB into a new AABB with the given rotation, offset and scale. * * @param rotation The rotation from the current AABB to the new AABB. * @param offset The offset between the current AABB and the new AABB. * @param scale The scale of the new AABB with respect to the old AABB. * @return The new transformed AABB. */ public AABB transform(Quat4f rotation, Vector3f offset, float scale) { Transform transform = new Transform(offset, rotation, scale); return transform(transform); }
@ReceiveEvent public void onTargetChanged(PlayerTargetChangedEvent event, EntityRef entity) { EntityRef target = event.getNewTarget(); if (target.exists()) { LocationComponent location = target.getComponent(LocationComponent.class); if (location != null) { BlockComponent blockComp = target.getComponent(BlockComponent.class); BlockRegionComponent blockRegion = target.getComponent(BlockRegionComponent.class); if (blockComp != null || blockRegion != null) { Vector3f blockPos = location.getWorldPosition(); Block block = worldProvider.getBlock(blockPos); aabb = block.getBounds(blockPos); } else { MeshComponent mesh = target.getComponent(MeshComponent.class); if (mesh != null && mesh.mesh != null) { aabb = mesh.mesh.getAABB(); aabb = aabb.transform(location.getWorldRotation(), location.getWorldPosition(), location.getWorldScale()); } } } } else { aabb = null; } }
float worldScale = location.getWorldScale(); aabb = aabb.transform(worldRot, worldPos, worldScale); if (!worldRenderer.getActiveCamera().hasInSight(aabb)) { continue;
Matrix4f matrixCameraSpace = new Matrix4f(worldRot, offsetFromCamera, worldScale); AABB aabb = meshComp.mesh.getAABB().transform(toWorldSpace); if (worldRenderer.getActiveCamera().hasInSight(aabb)) { if (meshComp.mesh != lastMesh) {