Class: MSPhysics::Hinge

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

Overview

Since:

  • 1.0.0

Constant Summary

DEFAULT_MIN =

Since:

  • 1.0.0

-180.0.degrees
DEFAULT_MAX =

Since:

  • 1.0.0

180.0.degrees
DEFAULT_LIMITS_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_MODE =

Since:

  • 1.0.0

0
DEFAULT_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ACCEL =

Since:

  • 1.0.0

40.0
DEFAULT_DAMP =

Since:

  • 1.0.0

0.1
DEFAULT_STRENGTH =

Since:

  • 1.0.0

0.8
DEFAULT_SPRING_CONSTANT =

Since:

  • 1.0.0

40.0
DEFAULT_SPRING_DRAG =

Since:

  • 1.0.0

1.0
DEFAULT_START_ANGLE =

Since:

  • 1.0.0

0.0.degrees
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, #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) ⇒ Hinge

Create a hinge 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

Instance Method Details

#accelNumeric

Note:

This option associates with the normal spring mode.

Get spring oscillation acceleration factor.

Returns:

  • (Numeric)

    An acceleration factor, a value greater than or equal to zero.

Since:

  • 1.0.0

#accel=(value) ⇒ Object

Note:

This option associates with the normal spring mode.

Set spring oscillation acceleration factor.

Parameters:

  • value (Numeric)

    An acceleration factor, a value greater than or equal to zero.

Since:

  • 1.0.0

#controllerNumeric

Get hinge controller, the magnitude of the rotational friction or the magnitude and direction of the starting angle, depending on the mode.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#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.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#cur_alphaNumeric

Get current angular acceleration in radians per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_angleNumeric

Get current angle in radians with respect to the starting angle.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_omegaNumeric

Get current angular velocity in radians per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#dampNumeric

Note:

This option associates with the normal spring mode.

Get spring oscillation damping coefficient.

Returns:

  • (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0

#damp=(value) ⇒ Object

Note:

This option associates with the normal spring mode.

Set spring oscillation damping coefficient.

Parameters:

  • value (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0

#frictionNumeric

Note:

This option associates with friction mode.

Note:

The actual friction is friction * controller.

Get rotational friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#friction=(value) ⇒ Object

Note:

This option associates with friction mode.

Note:

The actual friction is friction * controller.

Set rotational friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#limits_enabled=(state) ⇒ Object

Enable/disable min & max angle limits.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#limits_enabled?Boolean

Determine whether min & max angle limits are enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#maxNumeric

Get maximum angle in radians with respect to the starting angle.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#max=(value) ⇒ Object

Set maximum angle in radians with respect to the starting angle.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#minNumeric

Get minimum angle in radians with respect to the starting angle.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#min=(value) ⇒ Object

Set minimum angle in radians with respect to the starting angle.

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#modeFixnum

Get mode.

Returns:

  • (Fixnum)
    • 0 - if using friction option

    • 1 - if using spring accel, damp, and strength options.

    • 2 - if using Hooke's spring constant and drag coefficient.

Since:

  • 1.0.0

#mode=(value) ⇒ Object

Set mode.

Parameters:

  • value (Fixnum)
    • 0 - use friction option

    • 1 - use spring accel, damp, and strength options.

    • 2 - use Hooke's spring constant and drag coefficient options.

Since:

  • 1.0.0

#spring_constantNumeric

Note:

This option associates with the Hooke's spring mode.

Get Hooke's spring constant.

Returns:

  • (Numeric)

    A spring constant in kg/s², a value greater than or equal to zero.

Since:

  • 1.0.0

#spring_constant=(value) ⇒ Object

Note:

This option associates with the Hooke's spring mode.

Set Hooke's spring constant.

Parameters:

  • value (Numeric)

    A spring constant in kg/s², a value greater than or equal to zero.

Since:

  • 1.0.0

#spring_dragNumeric

Note:

This option associates with the Hooke's spring mode.

Get Hooke's spring drag.

Returns:

  • (Numeric)

    A spring drag coefficient in kg/s, a value greater than or equal to zero.

Since:

  • 1.0.0

#spring_drag=(value) ⇒ Object

Note:

This option associates with the Hooke's spring mode.

Set Hooke's spring drag.

Parameters:

  • value (Numeric)

    A spring drag coefficient in kg/s, a value greater than or equal to zero.

Since:

  • 1.0.0

#start_angleNumeric

Note:

This associates with the spring modes only.

Note:

The actual starting angle is, start_angle * controller.

Get starting angle in radians.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#start_angle=(angle) ⇒ Object

Note:

This associates with the spring modes only.

Note:

The actual starting angle is, start_angle * controller.

Set starting angle in radians.

Parameters:

  • angle (Numeric)

Since:

  • 1.0.0

#strengthNumeric

Note:

This option associates with the normal spring mode.

Get spring oscillation strength coefficient.

Returns:

  • (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0

#strength=(value) ⇒ Object

Note:

This option associates with the normal spring mode.

Set spring oscillation strength coefficient.

Parameters:

  • value (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0