mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Gravity constant moved into constants.rb, camera can now report what it is looking at, entity has knowledge of camera now, AABB tree search can now use either BoundingBox or Ray colliders
This commit is contained in:
@@ -55,13 +55,13 @@ class IMICFPS
|
||||
end
|
||||
end
|
||||
|
||||
def search_subtree(bounding_box, items = [])
|
||||
if @bounding_box.intersect?(bounding_box)
|
||||
def search_subtree(collider, items = [])
|
||||
if @bounding_box.intersect?(collider)
|
||||
if leaf?
|
||||
items << self
|
||||
else
|
||||
@a.search_subtree(bounding_box, items)
|
||||
@b.search_subtree(bounding_box, items)
|
||||
@a.search_subtree(collider, items)
|
||||
@b.search_subtree(collider, items)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ class IMICFPS
|
||||
insert_leaf(leaf)
|
||||
end
|
||||
|
||||
# Returns a list of all collided objects inside Bounding Box
|
||||
def search(bounding_box, return_nodes = false)
|
||||
# Returns a list of all objects that collided with collider
|
||||
def search(collider, return_nodes = false)
|
||||
items = []
|
||||
if @root
|
||||
items = @root.search_subtree(bounding_box)
|
||||
items = @root.search_subtree(collider)
|
||||
items.map! {|e| e.object} unless return_nodes
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user