Class: BulldogPhysics::OctTreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/RigidBodies/rigid_collisions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOctTreeNode

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

#childrenObject

Returns the value of attribute children.



137
138
139
# File 'lib/RigidBodies/rigid_collisions.rb', line 137

def children
  @children
end

#positionObject

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