Class: BulldogPhysics::QuadTreeNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQuadTreeNode

Returns a new instance of QuadTreeNode.



123
124
125
126
# File 'lib/RigidBodies/rigid_collisions.rb', line 123

def initialize()
	@position = Vector3.new
	@children = Array.new(4, QuadTreeNode.new)
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



121
122
123
# File 'lib/RigidBodies/rigid_collisions.rb', line 121

def children
  @children
end

#positionObject

Returns the value of attribute position.



121
122
123
# File 'lib/RigidBodies/rigid_collisions.rb', line 121

def position
  @position
end

Instance Method Details

#get_child_index(object_centre) ⇒ Object



128
129
130
131
132
133
# File 'lib/RigidBodies/rigid_collisions.rb', line 128

def get_child_index(object_centre)
	index = 0
	index += 1 if object_centre.x > @position.x
	index += 2 if object_centre.z > @position.z
	index
end