Class: BulldogPhysics::OctTreeNode
- Inherits:
-
Object
- Object
- BulldogPhysics::OctTreeNode
- Defined in:
- lib/RigidBodies/rigid_collisions.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #get_child_index(object_centre) ⇒ Object
-
#initialize ⇒ OctTreeNode
constructor
A new instance of OctTreeNode.
Constructor Details
#initialize ⇒ OctTreeNode
Returns a new instance of OctTreeNode.
139 140 141 142 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 139 def initialize() @position = Vector3.new @children = Array.new(8, OctTreeNode.new) end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
137 138 139 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 137 def children @children end |
#position ⇒ Object
Returns the value of attribute position.
137 138 139 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 137 def position @position end |
Instance Method Details
#get_child_index(object_centre) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 144 def get_child_index(object_centre) index = 0 index += 1 if object_centre.x > @position.x index += 2 if object_centre.y > @position.y index += 4 if object_centre.z > @position.z index end |