Class: MSPhysics::Joint

Inherits:
Entity
  • Object
show all
Defined in:
RubyExtension/MSPhysics/joint.rb

Overview

An abstract for all joints.

Since:

  • 1.0.0

Constant Summary

DEFAULT_SOLVER_MODEL =

Since:

  • 1.0.0

2
DEFAULT_STIFFNESS =

Since:

  • 1.0.0

1.00
DEFAULT_BODIES_COLLIDABLE =

Since:

  • 1.0.0

false
DEFAULT_BREAKING_FORCE =

Since:

  • 1.0.0

0.0

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(world, parent, pin_tra, group_inst = nil) ⇒ Joint

Returns a new instance of 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_inst (Sketchup::Group, Sketchup::ComponentInstance, nil) (defaults to: nil)

Since:

  • 1.0.0

Class Method Details

.all_jointsArray<Joint>

Note:

Joints that do not have a MSPhysics::Joint instance are not included in the array.

Get all joints.

Returns:

Since:

  • 1.0.0

.joint_by_address(address) ⇒ Joint?

Get joint by address.

Parameters:

  • address (Fixnum)

Returns:

  • (Joint, nil)

    A Joint object if successful.

Raises:

  • (TypeError)

    if the address is invalid.

Since:

  • 1.0.0

.validate(joint, world = nil) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Verify that joint is valid.

Parameters:

  • joint (Joint)
  • world (World, nil) (defaults to: nil)

    A world the joint ought to belong to or nil.

Raises:

  • (TypeError)

    if joint is invalid or destroyed.

Since:

  • 1.0.0

Instance Method Details

#addressFixnum

Get pointer the joint.

Returns:

  • (Fixnum)

Since:

  • 1.0.0

#bodies_collidable=(state) ⇒ Object

Set parent body collidable/noncollidable with its child body.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#bodies_collidable?Boolean

Determine whether parent body is collidable with its child body.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#breaking_forceNumeric

Get joint breaking force in Newtons.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#breaking_force=(force) ⇒ Object

Set joint breaking force in Newtons.

Parameters:

  • force (Numeric)

Since:

  • 1.0.0

#childMSPhysics::Body?

Get joint child body.

Returns:

Since:

  • 1.0.0

#connect(child) ⇒ Boolean

Connect joint to its desired child body.

Parameters:

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

#connected?Boolean

Determine whether joint is connected to its child body.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#destroyvoid

This method returns an undefined value.

Destroy joint.

Since:

  • 1.0.0

#disconnectBoolean

Disconnect joint from its child body.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

#dofFixnum

Get joint maximum degrees of freedom.

Returns:

  • (Fixnum)

Since:

  • 1.0.0

#get_pin_matrixGeom::Transformation

Get joint pin transformation in global space.

Returns:

  • (Geom::Transformation)

Since:

  • 1.0.0

#get_pin_matrix2(mode) ⇒ Geom::Transformation?

Get joint pin transformation in global space.

Parameters:

  • mode (Fixnum)
    • Pass 0 to obtain aligned pin matrix in global space with respect to the child body.

    • Pass 1 to obtain aligned pin matrix in global space with respect to the parent body.

    • Pass 2 to obtain non-aligned pin matrix in global space with respect to the parent body.

Returns:

  • (Geom::Transformation, nil)

Since:

  • 1.0.0

#groupSketchup::Group, ...

Get group/component associated with the joint.

Returns:

  • (Sketchup::Group, Sketchup::ComponentInstance, nil)

Since:

  • 1.0.0

#nameString

Get joint name.

Returns:

  • (String)

Since:

  • 1.0.0

#name=(value) ⇒ Object

Set joint name

Parameters:

  • value (String)

Since:

  • 1.0.0

#parentMSPhysics::Body?

Get joint parent body.

Returns:

Since:

  • 1.0.0

#set_pin_matrix(matrix) ⇒ nil

Set joint pin transformation in global space.

Parameters:

  • matrix (Geom::Transformation, Array<Numeric>)

Returns:

  • (nil)

Since:

  • 1.0.0

#solver_modelFixnum

Get solver model for calculating the constraint forces.

Returns:

  • (Fixnum)

    Model:

    • 0 - Use best algorithm.

    • 1 - Signal the engine that two joints form a kinematic loop.

    • 2 - Use less accurate algorithm.

Since:

  • 1.0.0

#solver_model=(model) ⇒ Object

Set solver model for calculating the constraint forces.

Parameters:

  • model (Fixnum)

    Solver model:

    • 0 - Use best algorithm.

    • 1 - Signal the engine that two joints form a kinematic loop.

    • 2 - Use less accurate algorithm.

Since:

  • 1.0.0

#stiffnessNumeric

Get joint stiffness.

Returns:

  • (Numeric)

    A value between 0.0 (soft) and 1.0 (stiff).

Since:

  • 1.0.0

#stiffness=(value) ⇒ Object

Set joint stiffness

Parameters:

  • value (Numeric)

    A value between 0.0 (soft) and 1.0 (stiff).

Since:

  • 1.0.0

#typeFixnum

Get joint type.

Returns:

  • (Fixnum)

See Also:

Since:

  • 1.0.0

#valid?Boolean

Determine whether joint is valid.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#worldMSPhysics::World

Get the world the joint is associated to.

Returns:

Since:

  • 1.0.0