Class: BulldogPhysics::Gravity

Inherits:
ForceGenerator show all
Defined in:
lib/RigidBodies/Gravity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#gravityObject (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