embooglement
Member
I'm developing a mass aggregate physics engine with RMXP. One of the components is the module that follows:
One thing to note, I'm not entirely sure if my conversion of a slope to radian measure is even remotely accurate. But alas, that is not my problem.
As it is, when I try to call Spring_Physics.point_direction() I get an error saying " undefined method for `point_direction' for Spring_Physics:module ".
I'm desperately confused. Admittedly, I haven't defined any modules before, but from everything I can tell, this should work. Anyone have any suggestions?
And while I'm at it, anyone know the way to take a line defined by two points and get the radian angle formed by them?
Any help would be greatly appreciated!
Code:
#=============================================================================
#-----------------------------------------------------------------------------
# ** Spring_Physics
#-----------------------------------------------------------------------------
#=============================================================================
module Spring_Physics
 #---------------------------------------------------------------------------
 # This module defines physics constants for spring physic objects
 #---------------------------------------------------------------------------
 G = 1.0   # Gravity
 K = 0.025  # Spring Constant
 D = 0.95  # Dampening
 R = 25.0  # Rest Length
 #---------------------------------------------------------------------------
 # * Point_Direction
 # Returns the radian angle of the line formed between the two points.
 #---------------------------------------------------------------------------
 def point_direction(x1, y1, x2, y2)
  r = (x1 - x2) / (y1 - y2)
  r *= Math::PI/4
  return r
 end
end
One thing to note, I'm not entirely sure if my conversion of a slope to radian measure is even remotely accurate. But alas, that is not my problem.
As it is, when I try to call Spring_Physics.point_direction() I get an error saying " undefined method for `point_direction' for Spring_Physics:module ".
I'm desperately confused. Admittedly, I haven't defined any modules before, but from everything I can tell, this should work. Anyone have any suggestions?
And while I'm at it, anyone know the way to take a line defined by two points and get the radian angle formed by them?
Any help would be greatly appreciated!