Class: MSPhysics::Hinge
- Defined in:
- RubyExtension/MSPhysics/joint_hinge.rb
Overview
Constant Summary collapse
- DEFAULT_MIN =
-180.0.degrees
- DEFAULT_MAX =
180.0.degrees
- DEFAULT_LIMITS_ENABLED =
false
- DEFAULT_MODE =
0
- DEFAULT_FRICTION =
0.0
- DEFAULT_ACCEL =
40.0
- DEFAULT_DAMP =
0.1
- DEFAULT_STRENGTH =
0.8
- DEFAULT_SPRING_CONSTANT =
40.0
- DEFAULT_SPRING_DRAG =
1.0
- DEFAULT_START_ANGLE =
0.0.degrees
- DEFAULT_CONTROLLER =
1.0
Constants inherited from Joint
Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS
Instance Method Summary collapse
-
#accel ⇒ Numeric
Get spring oscillation acceleration factor.
-
#accel=(value) ⇒ Object
Set spring oscillation acceleration factor.
-
#controller ⇒ Numeric
Get hinge controller, the magnitude of the rotational friction or the magnitude and direction of the starting angle, depending on the mode.
-
#controller=(value) ⇒ Object
Set hinge controller, the magnitude of the rotational friction or the magnitude and direction of the starting angle, depending on the mode.
-
#cur_alpha ⇒ Numeric
Get current angular acceleration in radians per second per second.
-
#cur_angle ⇒ Numeric
Get current angle in radians with respect to the starting angle.
-
#cur_omega ⇒ Numeric
Get current angular velocity in radians per second.
-
#damp ⇒ Numeric
Get spring oscillation damping coefficient.
-
#damp=(value) ⇒ Object
Set spring oscillation damping coefficient.
-
#friction ⇒ Numeric
Get rotational friction.
-
#friction=(value) ⇒ Object
Set rotational friction.
-
#initialize(world, parent, pin_tra, group = nil) ⇒ Hinge
constructor
Create a hinge joint.
-
#limits_enabled=(state) ⇒ Object
Enable/disable min & max angle limits.
-
#limits_enabled? ⇒ Boolean
Determine whether min & max angle limits are enabled.
-
#max ⇒ Numeric
Get maximum angle in radians with respect to the starting angle.
-
#max=(value) ⇒ Object
Set maximum angle in radians with respect to the starting angle.
-
#min ⇒ Numeric
Get minimum angle in radians with respect to the starting angle.
-
#min=(value) ⇒ Object
Set minimum angle in radians with respect to the starting angle.
-
#mode ⇒ Integer
Get mode.
-
#mode=(value) ⇒ Object
Set mode.
-
#spring_constant ⇒ Numeric
Get Hooke’s spring constant.
-
#spring_constant=(value) ⇒ Object
Set Hooke’s spring constant.
-
#spring_drag ⇒ Numeric
Get Hooke’s spring drag.
-
#spring_drag=(value) ⇒ Object
Set Hooke’s spring drag.
-
#start_angle ⇒ Numeric
Get starting angle in radians.
-
#start_angle=(angle) ⇒ Object
Set starting angle in radians.
-
#strength ⇒ Numeric
Get spring oscillation strength coefficient.
-
#strength=(value) ⇒ Object
Set spring oscillation strength coefficient.
Methods inherited from Joint
#address, all_joints, #bodies_collidable=, #bodies_collidable?, #breaking_force, #breaking_force=, #child, #connect, #connected?, #destroy, #disconnect, #dof, #get_pin_matrix, #get_pin_matrix2, #get_tension1, #get_tension2, #group, joint_by_address, #name, #name=, #parent, #set_pin_matrix, #solver_model, #solver_model=, #stiffness, #stiffness=, #type, #valid?, validate, #world
Methods inherited from Entity
Constructor Details
#initialize(world, parent, pin_tra, group = nil) ⇒ Hinge
Create a hinge joint.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 26 def initialize(world, parent, pin_tra, group = nil) super(world, parent, pin_tra, group) MSPhysics::Newton::Hinge.create(@address) MSPhysics::Newton::Hinge.set_min(@address, DEFAULT_MIN) MSPhysics::Newton::Hinge.set_max(@address, DEFAULT_MAX) MSPhysics::Newton::Hinge.enable_limits(@address, DEFAULT_LIMITS_ENABLED) MSPhysics::Newton::Hinge.set_mode(@address, DEFAULT_MODE) MSPhysics::Newton::Hinge.set_friction(@address, DEFAULT_FRICTION) MSPhysics::Newton::Hinge.set_accel(@address, DEFAULT_ACCEL) MSPhysics::Newton::Hinge.set_damp(@address, DEFAULT_DAMP) MSPhysics::Newton::Hinge.set_strength(@address, DEFAULT_STRENGTH) MSPhysics::Newton::Hinge.set_spring_constant(@address, DEFAULT_SPRING_CONSTANT) MSPhysics::Newton::Hinge.set_spring_drag(@address, DEFAULT_SPRING_DRAG) MSPhysics::Newton::Hinge.set_start_angle(@address, DEFAULT_START_ANGLE) MSPhysics::Newton::Hinge.set_controller(@address, DEFAULT_CONTROLLER) end |
Instance Method Details
#accel ⇒ Numeric
This option associates with the normal spring mode.
Get spring oscillation acceleration factor.
135 136 137 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 135 def accel MSPhysics::Newton::Hinge.get_accel(@address) end |
#accel=(value) ⇒ Object
This option associates with the normal spring mode.
Set spring oscillation acceleration factor.
143 144 145 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 143 def accel=(value) MSPhysics::Newton::Hinge.set_accel(@address, value) end |
#controller ⇒ Numeric
Get hinge controller, the magnitude of the rotational friction or the magnitude and direction of the starting angle, depending on the mode.
226 227 228 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 226 def controller MSPhysics::Newton::Hinge.get_controller(@address) end |
#controller=(value) ⇒ Object
Set hinge controller, the magnitude of the rotational friction or the magnitude and direction of the starting angle, depending on the mode.
233 234 235 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 233 def controller=(value) MSPhysics::Newton::Hinge.set_controller(@address, value) end |
#cur_alpha ⇒ Numeric
Get current angular acceleration in radians per second per second.
57 58 59 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 57 def cur_alpha MSPhysics::Newton::Hinge.get_cur_alpha(@address) end |
#cur_angle ⇒ Numeric
Get current angle in radians with respect to the starting angle.
45 46 47 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 45 def cur_angle MSPhysics::Newton::Hinge.get_cur_angle(@address) end |
#cur_omega ⇒ Numeric
Get current angular velocity in radians per second.
51 52 53 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 51 def cur_omega MSPhysics::Newton::Hinge.get_cur_omega(@address) end |
#damp ⇒ Numeric
This option associates with the normal spring mode.
Get spring oscillation damping coefficient.
150 151 152 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 150 def damp MSPhysics::Newton::Hinge.get_damp(@address) end |
#damp=(value) ⇒ Object
This option associates with the normal spring mode.
Set spring oscillation damping coefficient.
157 158 159 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 157 def damp=(value) MSPhysics::Newton::Hinge.set_damp(@address, value) end |
#friction ⇒ Numeric
This option associates with friction mode.
The actual friction is friction * controller
.
Get rotational friction.
119 120 121 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 119 def friction MSPhysics::Newton::Hinge.get_friction(@address) end |
#friction=(value) ⇒ Object
This option associates with friction mode.
The actual friction is friction * controller
.
Set rotational friction.
127 128 129 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 127 def friction=(value) MSPhysics::Newton::Hinge.set_friction(@address, value) end |
#limits_enabled=(state) ⇒ Object
Enable/disable min & max angle limits.
93 94 95 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 93 def limits_enabled=(state) MSPhysics::Newton::Hinge.enable_limits(@address, state) end |
#limits_enabled? ⇒ Boolean
Determine whether min & max angle limits are enabled.
87 88 89 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 87 def limits_enabled? MSPhysics::Newton::Hinge.limits_enabled?(@address) end |
#max ⇒ Numeric
Get maximum angle in radians with respect to the starting angle.
75 76 77 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 75 def max MSPhysics::Newton::Hinge.get_max(@address) end |
#max=(value) ⇒ Object
Set maximum angle in radians with respect to the starting angle.
81 82 83 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 81 def max=(value) MSPhysics::Newton::Hinge.set_max(@address, value) end |
#min ⇒ Numeric
Get minimum angle in radians with respect to the starting angle.
63 64 65 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 63 def min MSPhysics::Newton::Hinge.get_min(@address) end |
#min=(value) ⇒ Object
Set minimum angle in radians with respect to the starting angle.
69 70 71 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 69 def min=(value) MSPhysics::Newton::Hinge.set_min(@address, value) end |
#mode ⇒ Integer
Get mode.
102 103 104 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 102 def mode MSPhysics::Newton::Hinge.get_mode(@address) end |
#mode=(value) ⇒ Object
Set mode.
111 112 113 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 111 def mode=(value) MSPhysics::Newton::Hinge.set_mode(@address, value) end |
#spring_constant ⇒ Numeric
This option associates with the Hooke’s spring mode.
Get Hooke’s spring constant.
179 180 181 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 179 def spring_constant MSPhysics::Newton::Hinge.get_spring_constant(@address) end |
#spring_constant=(value) ⇒ Object
This option associates with the Hooke’s spring mode.
Set Hooke’s spring constant.
187 188 189 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 187 def spring_constant=(value) MSPhysics::Newton::Hinge.set_spring_constant(@address, value) end |
#spring_drag ⇒ Numeric
This option associates with the Hooke’s spring mode.
Get Hooke’s spring drag.
195 196 197 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 195 def spring_drag MSPhysics::Newton::Hinge.get_spring_drag(@address) end |
#spring_drag=(value) ⇒ Object
This option associates with the Hooke’s spring mode.
Set Hooke’s spring drag.
203 204 205 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 203 def spring_drag=(value) MSPhysics::Newton::Hinge.set_spring_drag(@address, value) end |
#start_angle ⇒ Numeric
This associates with the spring modes only.
The actual starting angle is, start_angle * controller
.
Get starting angle in radians.
211 212 213 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 211 def start_angle MSPhysics::Newton::Hinge.get_start_angle(@address) end |
#start_angle=(angle) ⇒ Object
This associates with the spring modes only.
The actual starting angle is, start_angle * controller
.
Set starting angle in radians.
219 220 221 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 219 def start_angle=(angle) MSPhysics::Newton::Hinge.set_start_angle(@address, angle) end |
#strength ⇒ Numeric
This option associates with the normal spring mode.
Get spring oscillation strength coefficient.
164 165 166 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 164 def strength MSPhysics::Newton::Hinge.get_strength(@address) end |
#strength=(value) ⇒ Object
This option associates with the normal spring mode.
Set spring oscillation strength coefficient.
171 172 173 |
# File 'RubyExtension/MSPhysics/joint_hinge.rb', line 171 def strength=(value) MSPhysics::Newton::Hinge.set_strength(@address, value) end |