Class: BulldogPhysics::Gravity
- Inherits:
-
ForceGenerator
- Object
- ForceGenerator
- BulldogPhysics::Gravity
- Defined in:
- lib/RigidBodies/Gravity.rb
Instance Attribute Summary collapse
-
#gravity ⇒ Object
readonly
vector3 accel do to gravity.
Instance Method Summary collapse
-
#initialize(grav) ⇒ Gravity
constructor
A new instance of Gravity.
- #update_force(body, duration) ⇒ Object
Constructor Details
#initialize(grav) ⇒ Gravity
Returns a new instance of Gravity.
6 7 8 |
# File 'lib/RigidBodies/Gravity.rb', line 6 def initialize(grav) @gravity = grav end |
Instance Attribute Details
#gravity ⇒ Object (readonly)
vector3 accel do to gravity
4 5 6 |
# File 'lib/RigidBodies/Gravity.rb', line 4 def gravity @gravity end |
Instance Method Details
#update_force(body, duration) ⇒ Object
10 11 12 13 14 |
# File 'lib/RigidBodies/Gravity.rb', line 10 def update_force(body, duration) #return if body.hasFiniteMass body.add_force(gravity * body.mass) end |