Class: BulldogPhysics::CollisionPrimitive

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

Direct Known Subclasses

CollisionBox, CollisionSphere

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCollisionPrimitive

Returns a new instance of CollisionPrimitive.



8
9
10
11
12
13
# File 'lib/RigidBodies/collision_shapes.rb', line 8

def initialize()
	#puts "INIT"
	@body = RigidBody.new
	@offset = Matrix4.new
	@transform = Matrix4.new
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/RigidBodies/collision_shapes.rb', line 5

def body
  @body
end

#offsetObject

Returns the value of attribute offset.



5
6
7
# File 'lib/RigidBodies/collision_shapes.rb', line 5

def offset
  @offset
end

#transformObject (readonly)

Returns the value of attribute transform.



15
16
17
# File 'lib/RigidBodies/collision_shapes.rb', line 15

def transform
  @transform
end

Instance Method Details

#calculate_internalsObject



17
18
19
20
# File 'lib/RigidBodies/collision_shapes.rb', line 17

def calculate_internals()
	#puts "OFFSET #{@offset}"
	@transform = @body.transform_matrix * @offset
end

#get_axis(index) ⇒ Object



22
23
24
# File 'lib/RigidBodies/collision_shapes.rb', line 22

def get_axis(index)
	@transform.getAxisVector(index)
end

#get_transformObject



26
27
28
# File 'lib/RigidBodies/collision_shapes.rb', line 26

def get_transform
	@transform
end