Class: MSPhysics::Corkscrew

Inherits:
Joint show all
Defined in:
RubyExtension/MSPhysics/joint_corkscrew.rb

Overview

Since:

  • 1.0.0

Constant Summary collapse

DEFAULT_MIN_POSITION =

Since:

  • 1.0.0

-10.0
DEFAULT_MAX_POSITION =

Since:

  • 1.0.0

10.0
DEFAULT_MIN_ANGLE =

Since:

  • 1.0.0

-180.0.degrees
DEFAULT_MAX_ANGLE =

Since:

  • 1.0.0

180.0.degrees
DEFAULT_LINEAR_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_ANGULAR_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_LINEAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ANGULAR_FRICTION =

Since:

  • 1.0.0

0.0

Constants inherited from Joint

Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS

Instance Method Summary collapse

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

#inspect, #to_s

Constructor Details

#initialize(world, parent, pin_tra, group = nil) ⇒ Corkscrew

Create a corkscrew joint.

Parameters:

  • world (MSPhysics::World)
  • parent (MSPhysics::Body, nil)
  • pin_tra (Geom::Transformation, Array<Numeric>)

    Pin transformation in global space. Matrix origin is interpreted as the pin position. Matrix Z-axis is interpreted as the pin direction.

  • group (Sketchup::Group, Sketchup::ComponentInstance, nil) (defaults to: nil)

Since:

  • 1.0.0



22
23
24
25
26
27
28
29
30
31
32
33
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 22

def initialize(world, parent, pin_tra, group = nil)
  super(world, parent, pin_tra, group)
  MSPhysics::Newton::Corkscrew.create(@address)
  MSPhysics::Newton::Corkscrew.set_min_position(@address, DEFAULT_MIN_POSITION)
  MSPhysics::Newton::Corkscrew.set_max_position(@address, DEFAULT_MAX_POSITION)
  MSPhysics::Newton::Corkscrew.enable_linear_limits(@address, DEFAULT_LINEAR_LIMITS_ENABLED)
  MSPhysics::Newton::Corkscrew.set_linear_friction(@address, DEFAULT_LINEAR_FRICTION)
  MSPhysics::Newton::Corkscrew.set_min_angle(@address, DEFAULT_MIN_ANGLE)
  MSPhysics::Newton::Corkscrew.set_max_angle(@address, DEFAULT_MAX_ANGLE)
  MSPhysics::Newton::Corkscrew.enable_angular_limits(@address, DEFAULT_ANGULAR_LIMITS_ENABLED)
  MSPhysics::Newton::Corkscrew.set_angular_friction(@address, DEFAULT_ANGULAR_FRICTION)
end

Instance Method Details

#angular_frictionNumeric

Get rotational friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



156
157
158
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 156

def angular_friction
  MSPhysics::Newton::Corkscrew.get_angular_friction(@address)
end

#angular_friction=(value) ⇒ Object

Set rotational friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



162
163
164
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 162

def angular_friction=(value)
  MSPhysics::Newton::Corkscrew.set_angular_friction(@address, value)
end

#angular_limits_enabled=(state) ⇒ Object

Enable/disable min & max angle limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



150
151
152
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 150

def angular_limits_enabled=(state)
  MSPhysics::Newton::Corkscrew.enable_angular_limits(@address, state)
end

#angular_limits_enabled?Boolean

Determine whether min & max angle limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



144
145
146
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 144

def angular_limits_enabled?
  MSPhysics::Newton::Corkscrew.angular_limits_enabled?(@address)
end

#cur_accelerationNumeric

Get current linear acceleration in meters per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



49
50
51
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 49

def cur_acceleration
  MSPhysics::Newton::Corkscrew.get_cur_acceleration(@address)
end

#cur_alphaNumeric

Get current angular acceleration in radians per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



114
115
116
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 114

def cur_alpha
  MSPhysics::Newton::Corkscrew.get_cur_alpha(@address)
end

#cur_angleNumeric

Get current angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



102
103
104
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 102

def cur_angle
  MSPhysics::Newton::Corkscrew.get_cur_angle(@address)
end

#cur_omegaNumeric

Get current omega in radians per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



108
109
110
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 108

def cur_omega
  MSPhysics::Newton::Corkscrew.get_cur_omega(@address)
end

#cur_positionNumeric

Get current position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0



37
38
39
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 37

def cur_position
  MSPhysics::Newton::Corkscrew.get_cur_position(@address)
end

#cur_velocityNumeric

Get current velocity in meters per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



43
44
45
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 43

def cur_velocity
  MSPhysics::Newton::Corkscrew.get_cur_velocity(@address)
end

#linear_frictionNumeric

Get movement friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



90
91
92
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 90

def linear_friction
  MSPhysics::Newton::Corkscrew.get_linear_friction(@address)
end

#linear_friction=(value) ⇒ Object

Set movement friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



96
97
98
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 96

def linear_friction=(value)
  MSPhysics::Newton::Corkscrew.set_linear_friction(@address, value)
end

#linear_limits_enabled=(state) ⇒ Object

Enable/disable min and max position limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



84
85
86
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 84

def linear_limits_enabled=(state)
  MSPhysics::Newton::Corkscrew.enable_linear_limits(@address, state)
end

#linear_limits_enabled?Boolean

Determine whether min and max position limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



78
79
80
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 78

def linear_limits_enabled?
  MSPhysics::Newton::Corkscrew.linear_limits_enabled?(@address)
end

#max_angleNumeric

Get maximum angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



132
133
134
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 132

def max_angle
  MSPhysics::Newton::Corkscrew.get_max_angle(@address)
end

#max_angle=(value) ⇒ Object

Set maximum angle in radians.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



138
139
140
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 138

def max_angle=(value)
  MSPhysics::Newton::Corkscrew.set_max_angle(@address, value)
end

#max_positionNumeric

Get maximum position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0



67
68
69
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 67

def max_position
  MSPhysics::Newton::Corkscrew.get_max_position(@address)
end

#max_position=(value) ⇒ Object

Set maximum position in meters.

Since:

  • 1.0.0



72
73
74
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 72

def max_position=(value)
  MSPhysics::Newton::Corkscrew.set_max_position(@address, value)
end

#min_angleNumeric

Get minimum angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



120
121
122
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 120

def min_angle
  MSPhysics::Newton::Corkscrew.get_min_angle(@address)
end

#min_angle=(value) ⇒ Object

Set minimum angle in radians.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



126
127
128
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 126

def min_angle=(value)
  MSPhysics::Newton::Corkscrew.set_min_angle(@address, value)
end

#min_positionNumeric

Get minimum position in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0



55
56
57
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 55

def min_position
  MSPhysics::Newton::Corkscrew.get_min_position(@address)
end

#min_position=(value) ⇒ Object

Set minimum position in meters.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



61
62
63
# File 'RubyExtension/MSPhysics/joint_corkscrew.rb', line 61

def min_position=(value)
  MSPhysics::Newton::Corkscrew.set_min_position(@address, value)
end