diff --git a/lib/managers/collision_manager.rb b/lib/managers/collision_manager.rb index 7e4be3c..6b33c22 100644 --- a/lib/managers/collision_manager.rb +++ b/lib/managers/collision_manager.rb @@ -28,9 +28,9 @@ class IMICFPS @physics_manager.update # binding.irb - p @aabb_tree + # p @aabb_tree collisions.each do |ent, list| - puts "#{ent.class} -> [#{list.map{|e| e.class}.join(', ')}]" + # puts "#{ent.class} -> [#{list.map{|e| e.class}.join(', ')}]" end end diff --git a/lib/objects/camera.rb b/lib/objects/camera.rb index c377076..11e2d96 100644 --- a/lib/objects/camera.rb +++ b/lib/objects/camera.rb @@ -79,13 +79,6 @@ class IMICFPS glMatrixMode(GL_MODELVIEW) # The modelview matrix is where object information is stored. glLoadIdentity - # if $debug && @entity - # glBegin(GL_LINES) - # glColor3f(1,0,0) - # glVertex3f(@x, @y, @z) - # glVertex3f(@entity.x, @entity.y, @entity.z) - # glEnd - # end end def update diff --git a/lib/trees/aabb_node.rb b/lib/trees/aabb_node.rb index f20fb74..9ef552e 100644 --- a/lib/trees/aabb_node.rb +++ b/lib/trees/aabb_node.rb @@ -1,7 +1,8 @@ class IMICFPS class AABBTree class AABBNode - attr_accessor :bounding_box, :parent, :object, :a, :b + attr_accessor :bounding_box, :parent, :object + attr_reader :a, :b def initialize(parent:, object:, bounding_box:) @parent = parent @object = object @@ -11,6 +12,16 @@ class IMICFPS @b = nil end + def a=(leaf) + @a = leaf + @a.parent = self + end + + def b=(leaf) + @b = leaf + @b.parent = self + end + def leaf? @object end diff --git a/lib/trees/aabb_tree.rb b/lib/trees/aabb_tree.rb index 5d8b24a..ec29f8b 100644 --- a/lib/trees/aabb_tree.rb +++ b/lib/trees/aabb_tree.rb @@ -32,7 +32,6 @@ class IMICFPS def update(object, bounding_box) leaf = remove(object) leaf.bounding_box = bounding_box - @objects[object] = leaf insert_leaf(leaf) end @@ -50,7 +49,6 @@ class IMICFPS def remove(object) leaf = @objects.delete(object) @root = @root.remove_subtree(leaf) if leaf - @root.parent = nil return leaf end