Class: MSPhysics::Motor
- Defined in:
- RubyExtension/MSPhysics/joint_motor.rb
Overview
Constant Summary collapse
- DEFAULT_ACCEL =
1.0
- DEFAULT_DAMP =
0.5
- DEFAULT_FREE_ROTATE_ENABLED =
false
- 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 rotational acceleration in radians per second per second.
-
#accel=(value) ⇒ Object
Set rotational acceleration in radians per second per second.
-
#controller ⇒ Numeric
Get motor controller, magnitude and direction of the desired acceleration.
-
#controller=(value) ⇒ Object
Set motor controller, magnitude and direction of the desired acceleration.
-
#cur_alpha ⇒ Numeric
Get current angular acceleration in radians per second per second.
-
#cur_angle ⇒ Numeric
Get current angle in radians.
-
#cur_omega ⇒ Numeric
Get current angular velocity in radians per second.
-
#damp ⇒ Numeric
Get rotational damper.
-
#damp=(value) ⇒ Object
Set rotational damper.
-
#free_rotate_enabled=(state) ⇒ Object
Enable/disable free rotate.
-
#free_rotate_enabled? ⇒ Boolean
Determine whether free rotate is enabled.
-
#initialize(world, parent, pin_tra, group = nil) ⇒ Motor
constructor
Create a motor joint.
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) ⇒ Motor
Create a motor joint.
18 19 20 21 22 23 24 25 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 18 def initialize(world, parent, pin_tra, group = nil) super(world, parent, pin_tra, group) MSPhysics::Newton::Motor.create(@address) MSPhysics::Newton::Motor.set_accel(@address, DEFAULT_ACCEL) MSPhysics::Newton::Motor.set_damp(@address, DEFAULT_DAMP) MSPhysics::Newton::Motor.enable_free_rotate(@address, DEFAULT_FREE_ROTATE_ENABLED) MSPhysics::Newton::Motor.set_controller(@address, DEFAULT_CONTROLLER) end |
Instance Method Details
#accel ⇒ Numeric
The actual acceleration is accel * controller
.
The maximum angular rate in radians per second is accel * controller / damp
.
Get rotational acceleration in radians per second per second.
50 51 52 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 50 def accel MSPhysics::Newton::Motor.get_accel(@address) end |
#accel=(value) ⇒ Object
The actual acceleration is accel * controller
.
The maximum angular rate in radians per second is accel * controller / damp
.
Set rotational acceleration in radians per second per second.
59 60 61 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 59 def accel=(value) MSPhysics::Newton::Motor.set_accel(@address, value) end |
#controller ⇒ Numeric
The actual acceleration is accel * controller
.
The maximum angular rate in radians per second is accel * controller / damp
.
Get motor controller, magnitude and direction of the desired acceleration.
100 101 102 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 100 def controller MSPhysics::Newton::Motor.get_controller(@address) end |
#controller=(value) ⇒ Object
The actual acceleration is accel * controller
.
The maximum angular rate in radians per second is accel * controller / damp
.
Set motor controller, magnitude and direction of the desired acceleration.
109 110 111 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 109 def controller=(value) MSPhysics::Newton::Motor.set_controller(@address, value) end |
#cur_alpha ⇒ Numeric
Get current angular acceleration in radians per second per second.
41 42 43 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 41 def cur_alpha MSPhysics::Newton::Motor.get_cur_alpha(@address) end |
#cur_angle ⇒ Numeric
Get current angle in radians.
29 30 31 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 29 def cur_angle MSPhysics::Newton::Motor.get_cur_angle(@address) end |
#cur_omega ⇒ Numeric
Get current angular velocity in radians per second.
35 36 37 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 35 def cur_omega MSPhysics::Newton::Motor.get_cur_omega(@address) end |
#damp ⇒ Numeric
Higher damper makes rotation stronger.
The maximum angular rate in radians per second is accel * controller / damp
.
Get rotational damper.
68 69 70 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 68 def damp MSPhysics::Newton::Motor.get_damp(@address) end |
#damp=(value) ⇒ Object
Higher damper makes rotation stronger.
The maximum angular rate in radians per second is accel * controller / damp
.
Set rotational damper.
77 78 79 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 77 def damp=(value) MSPhysics::Newton::Motor.set_damp(@address, value) end |
#free_rotate_enabled=(state) ⇒ Object
Enable/disable free rotate. Free rotate allows the motor to spin freely when accel is zero.
91 92 93 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 91 def free_rotate_enabled=(state) MSPhysics::Newton::Motor.enable_free_rotate(@address, state) end |
#free_rotate_enabled? ⇒ Boolean
Determine whether free rotate is enabled. Free rotate allows the motor to spin freely when accel is zero.
84 85 86 |
# File 'RubyExtension/MSPhysics/joint_motor.rb', line 84 def free_rotate_enabled? MSPhysics::Newton::Motor.is_free_rotate_enabled?(@address) end |