Class: BulldogPhysics::Particles::Collisions::ParticleGroundContacts
- Inherits:
-
ParticleContactGenerator
- Object
- ParticleContactGenerator
- BulldogPhysics::Particles::Collisions::ParticleGroundContacts
- Defined in:
- lib/Particles/particle_ground_contacts.rb
Instance Attribute Summary collapse
-
#particles ⇒ Object
readonly
Returns the value of attribute particles.
Instance Method Summary collapse
- #add_contact(contactArray, limit) ⇒ Object
-
#initialize(particles) ⇒ ParticleGroundContacts
constructor
A new instance of ParticleGroundContacts.
Constructor Details
#initialize(particles) ⇒ ParticleGroundContacts
Returns a new instance of ParticleGroundContacts.
9 10 11 |
# File 'lib/Particles/particle_ground_contacts.rb', line 9 def initialize(particles) @particles = particles end |
Instance Attribute Details
#particles ⇒ Object (readonly)
Returns the value of attribute particles.
7 8 9 |
# File 'lib/Particles/particle_ground_contacts.rb', line 7 def particles @particles end |
Instance Method Details
#add_contact(contactArray, limit) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/Particles/particle_ground_contacts.rb', line 13 def add_contact(contactArray, limit) count = 0 @particles.each do |p| y = p.position.y if y < 0.0 contact = ParticleContact.new(p, nil) contact.penetration = (p.position - Vector3.new(p.position.x, 0, p.position.z)).magnitude.abs - p.radius contact.restitution = 0.2 contactArray << contact count+=1 end if( count >= limit) return count end end return count end |