/** * 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); }
/** * Set the collision box for the block * * @param offset The offset to the block's center * @param shape The shape of collision box */ public void setCollision(Vector3f offset, CollisionShape shape) { collisionShape = shape; collisionOffset = offset; bounds = shape.getAABB(new Transform(offset, new Quat4f(0, 0, 0, 1), 1.0f)); }
private ColliderInfo processCompoundShape(List<ColliderInfo> colliders) { CompoundShape collisionShape = COLLISION_SHAPE_FACTORY.getNewCompoundShape(); for (ColliderInfo collider : colliders) { Transform transform = new Transform(collider.offset, Rotation.none().getQuat4f(), 1.0f); collisionShape.addChildShape(transform, collider.collisionShape); } return new ColliderInfo(new Vector3f(), collisionShape); }
float worldScale = location.getWorldScale(); Transform toWorldSpace = new Transform(worldPos, worldRot, worldScale);