Class: BulldogPhysics::CollisionData

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCollisionData

Returns a new instance of CollisionData.



65
66
67
68
69
# File 'lib/RigidBodies/collision_shapes.rb', line 65

def initialize()
	@contacts = Array.new
	@current_contact = @contacts_count = @contacts_left = 0
	@friction = @restitution = @tolerance = 0.0
end

Instance Attribute Details

#contactsObject

Returns the value of attribute contacts.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def contacts
  @contacts
end

#contacts_countObject

Returns the value of attribute contacts_count.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def contacts_count
  @contacts_count
end

#contacts_leftObject

Returns the value of attribute contacts_left.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def contacts_left
  @contacts_left
end

#current_contactObject

Returns the value of attribute current_contact.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def current_contact
  @current_contact
end

#frictionObject

Returns the value of attribute friction.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def friction
  @friction
end

#restitutionObject

Returns the value of attribute restitution.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def restitution
  @restitution
end

#toleranceObject

Returns the value of attribute tolerance.



63
64
65
# File 'lib/RigidBodies/collision_shapes.rb', line 63

def tolerance
  @tolerance
end

Instance Method Details

#add_contacts(count) ⇒ Object



81
82
83
84
85
86
# File 'lib/RigidBodies/collision_shapes.rb', line 81

def add_contacts(count)
	@contacts_left -= count
	@contacts_count += count

	@current_contact += count
end

#has_more_contactsObject



71
72
73
# File 'lib/RigidBodies/collision_shapes.rb', line 71

def has_more_contacts()
	@contacts_left > 0
end

#reset(max_contacts) ⇒ Object



75
76
77
78
79
# File 'lib/RigidBodies/collision_shapes.rb', line 75

def reset(max_contacts)
	@contacts_left = max_contacts
	@contacts_count = 0
	@current_contact = 0
end