Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chimpro.london.collisiondetection;
- import org.lwjgl.util.vector.Vector3f;
- import com.chimpro.london.entity.Entity;
- public class AABB {
- public Vector3f min = new Vector3f(),max = new Vector3f();
- public AABB(Entity entity) {
- min = entity.getModel().getMin();
- max = entity.getModel().getMax();
- }
- public Vector3f getMin() {
- return min;
- }
- public Vector3f getMax() {
- return max;
- }
- public boolean overlapps(AABB other) {
- return !(this.max.x < other.min.x || this.min.x > other.max.x ||
- this.max.y < other.min.y || this.min.y > other.max.y ||
- this.max.z < other.min.z || this.min.z > other.max.z);
- }
- }
- package com.chimpro.london.collisiondetection;
- import java.util.Deque;
- import java.util.LinkedList;
- import java.util.List;
- public class SweepAndPrune {
- private static List<AABB> pairs = new LinkedList<>();
- private SweepAndPrune() {}
- public void addObject(AABB box) {
- }
- public void removeObject(AABB box) {
- }
- }
- package com.chimpro.london.collisiondetection;
- import org.lwjgl.util.vector.*;
- import com.chimpro.london.entity.Entity;
- public class Sphere {
- private Vector3f center = new Vector3f();
- private float radius = 0.0f;
- public Sphere(Entity entity) {
- Vector3f min = entity.getModel().getMin();
- Vector3f max = entity.getModel().getMax();
- }
- public Vector3f getCenter() {
- return center;
- }
- public float getRadius() {
- return radius;
- }
- }
Add Comment
Please, Sign In to add comment