Guest User

Untitled

a guest
Mar 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. package com.chimpro.london.collisiondetection;
  2.  
  3. import org.lwjgl.util.vector.Vector3f;
  4.  
  5. import com.chimpro.london.entity.Entity;
  6.  
  7. public class AABB {
  8. public Vector3f min = new Vector3f(),max = new Vector3f();
  9. public AABB(Entity entity) {
  10. min = entity.getModel().getMin();
  11. max = entity.getModel().getMax();
  12. }
  13.  
  14. public Vector3f getMin() {
  15. return min;
  16. }
  17.  
  18. public Vector3f getMax() {
  19. return max;
  20. }
  21.  
  22. public boolean overlapps(AABB other) {
  23. return !(this.max.x < other.min.x || this.min.x > other.max.x ||
  24. this.max.y < other.min.y || this.min.y > other.max.y ||
  25. this.max.z < other.min.z || this.min.z > other.max.z);
  26. }
  27.  
  28. }
  29.  
  30. package com.chimpro.london.collisiondetection;
  31.  
  32. import java.util.Deque;
  33. import java.util.LinkedList;
  34. import java.util.List;
  35.  
  36. public class SweepAndPrune {
  37. private static List<AABB> pairs = new LinkedList<>();
  38. private SweepAndPrune() {}
  39.  
  40. public void addObject(AABB box) {
  41. }
  42.  
  43. public void removeObject(AABB box) {
  44.  
  45. }
  46. }
  47.  
  48. package com.chimpro.london.collisiondetection;
  49.  
  50.  
  51. import org.lwjgl.util.vector.*;
  52.  
  53. import com.chimpro.london.entity.Entity;
  54.  
  55. public class Sphere {
  56. private Vector3f center = new Vector3f();
  57. private float radius = 0.0f;
  58. public Sphere(Entity entity) {
  59. Vector3f min = entity.getModel().getMin();
  60. Vector3f max = entity.getModel().getMax();
  61. }
  62.  
  63. public Vector3f getCenter() {
  64. return center;
  65. }
  66. public float getRadius() {
  67. return radius;
  68. }
  69.  
  70. }
Add Comment
Please, Sign In to add comment