Class: MSPhysics::BallAndSocket

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

Overview

Since:

  • 1.0.0

Constant Summary collapse

DEFAULT_MAX_CONE_ANGLE =

Since:

  • 1.0.0

30.0.degrees
DEFAULT_CONE_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_MIN_TWIST_ANGLE =

Since:

  • 1.0.0

-180.0.degrees
DEFAULT_MAX_TWIST_ANGLE =

Since:

  • 1.0.0

180.0.degrees
DEFAULT_TWIST_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_CONTROLLER =

Since:

  • 1.0.0

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

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) ⇒ BallAndSocket

Create a ball & socket 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



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

def initialize(world, parent, pin_tra, group = nil)
  super(world, parent, pin_tra, group)
  MSPhysics::Newton::BallAndSocket.create(@address)
  MSPhysics::Newton::BallAndSocket.set_max_cone_angle(@address, DEFAULT_MAX_CONE_ANGLE)
  MSPhysics::Newton::BallAndSocket.enable_cone_limits(@address, DEFAULT_CONE_LIMITS_ENABLED)
  MSPhysics::Newton::BallAndSocket.set_min_twist_angle(@address, DEFAULT_MIN_TWIST_ANGLE)
  MSPhysics::Newton::BallAndSocket.set_max_twist_angle(@address, DEFAULT_MAX_TWIST_ANGLE)
  MSPhysics::Newton::BallAndSocket.enable_twist_limits(@address, DEFAULT_TWIST_LIMITS_ENABLED)
  MSPhysics::Newton::BallAndSocket.set_friction(@address, DEFAULT_FRICTION)
  MSPhysics::Newton::BallAndSocket.set_controller(@address, DEFAULT_CONTROLLER)
end

Instance Method Details

#cone_limits_enabled=(state) ⇒ Object

Enable/disable cone angle limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



53
54
55
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 53

def cone_limits_enabled=(state)
  MSPhysics::Newton::BallAndSocket.enable_cone_limits(@address, state)
end

#cone_limits_enabled?Boolean

Determine whether cone angle limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



47
48
49
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 47

def cone_limits_enabled?
  MSPhysics::Newton::BallAndSocket.cone_limits_enabled?(@address)
end

#controllerNumeric

Note:

Default controller value is 1.0.

Note:

The actual friction is friction * controller.

Get magnitude of the angular friction.

Returns:

  • (Numeric)

Since:

  • 1.0.0



135
136
137
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 135

def controller
  MSPhysics::Newton::BallAndSocket.get_controller(@address)
end

#controller=(value) ⇒ Object

Note:

Default controller value is 1.0.

Note:

The actual friction is friction * controller.

Set magnitude of the angular friction.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0



143
144
145
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 143

def controller=(value)
  MSPhysics::Newton::BallAndSocket.set_controller(@address, value)
end

#cur_cone_angleNumeric

Get current cone angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



95
96
97
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 95

def cur_cone_angle
  MSPhysics::Newton::BallAndSocket.get_cur_cone_angle(@address)
end

#cur_twist_alphaNumeric

Get current twist acceleration in radians per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



113
114
115
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 113

def cur_twist_alpha
  MSPhysics::Newton::BallAndSocket.get_cur_twist_alpha(@address)
end

#cur_twist_angleNumeric

Get current twist angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



101
102
103
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 101

def cur_twist_angle
  MSPhysics::Newton::BallAndSocket.get_cur_twist_angle(@address)
end

#cur_twist_omegaNumeric

Get current twist omega in radians per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



107
108
109
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 107

def cur_twist_omega
  MSPhysics::Newton::BallAndSocket.get_cur_twist_omega(@address)
end

#frictionNumeric

Note:

The actual friction is friction * controller.

Get angular friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



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

def friction
  MSPhysics::Newton::BallAndSocket.get_friction(@address)
end

#friction=(value) ⇒ Object

Note:

The actual friction is friction * controller.

Set angular friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



127
128
129
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 127

def friction=(value)
  MSPhysics::Newton::BallAndSocket.set_friction(@address, value)
end

#max_cone_angleNumeric

Get maximum cone angle in radians.

Returns:

  • (Numeric)

    A value between 0.0 and PI.

Since:

  • 1.0.0



35
36
37
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 35

def max_cone_angle
  MSPhysics::Newton::BallAndSocket.get_max_cone_angle(@address)
end

#max_cone_angle=(angle) ⇒ Object

Set maximum cone angle in radians.

Parameters:

  • angle (Numeric)

    A value between 0.0 and PI.

Since:

  • 1.0.0



41
42
43
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 41

def max_cone_angle=(angle)
  MSPhysics::Newton::BallAndSocket.set_max_cone_angle(@address, angle)
end

#max_twist_angleNumeric

Get maximum twist angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



71
72
73
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 71

def max_twist_angle
  MSPhysics::Newton::BallAndSocket.get_max_twist_angle(@address)
end

#max_twist_angle=(angle) ⇒ Object

Set maximum twist angle in radians.

Parameters:

  • angle (Numeric)

Since:

  • 1.0.0



77
78
79
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 77

def max_twist_angle=(angle)
  MSPhysics::Newton::BallAndSocket.set_max_twist_angle(@address, angle)
end

#min_twist_angleNumeric

Get minimum twist angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0



59
60
61
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 59

def min_twist_angle
  MSPhysics::Newton::BallAndSocket.get_min_twist_angle(@address)
end

#min_twist_angle=(angle) ⇒ Object

Set minimum twist angle in radians.

Parameters:

  • angle (Numeric)

Since:

  • 1.0.0



65
66
67
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 65

def min_twist_angle=(angle)
  MSPhysics::Newton::BallAndSocket.set_min_twist_angle(@address, angle)
end

#twist_limits_enabled=(state) ⇒ Object

Enable/disable twist angle limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



89
90
91
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 89

def twist_limits_enabled=(state)
  MSPhysics::Newton::BallAndSocket.enable_twist_limits(@address, state)
end

#twist_limits_enabled?Boolean

Determine whether twist angle limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



83
84
85
# File 'RubyExtension/MSPhysics/joint_ball_and_socket.rb', line 83

def twist_limits_enabled?
  MSPhysics::Newton::BallAndSocket.twist_limits_enabled?(@address)
end