Class: MSPhysics::UpVector

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

Overview

Since:

  • 1.0.0

Constant Summary collapse

DEFAULT_ACCEL =

Since:

  • 1.0.0

40.0
DEFAULT_DAMP =

Since:

  • 1.0.0

10.0
DEFAULT_STRENGTH =

Since:

  • 1.0.0

0.98
DEFAULT_PIN_DIR =

Since:

  • 1.0.0

Z_AXIS

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

Create an UpVector 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



18
19
20
21
22
23
24
25
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 18

def initialize(world, parent, pin_tra, group = nil)
  super(world, parent, pin_tra, group)
  MSPhysics::Newton::UpVector.create(@address)
  MSPhysics::Newton::UpVector.set_accel(@address, DEFAULT_ACCEL)
  MSPhysics::Newton::UpVector.set_damp(@address, DEFAULT_DAMP)
  MSPhysics::Newton::UpVector.set_strength(@address, DEFAULT_STRENGTH)
  MSPhysics::Newton::UpVector.set_pin_dir(@address, DEFAULT_PIN_DIR)
end

Instance Method Details

#accelNumeric

Note:

Higher acceleration makes rotation faster.

Get angular acceleration.

Returns:

  • (Numeric)

Since:

  • 1.0.0



30
31
32
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 30

def accel
  MSPhysics::Newton::UpVector.get_accel(@address)
end

#accel=(value) ⇒ Object

Note:

Higher acceleration makes rotation faster.

Set angular acceleration.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



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

def accel=(value)
  MSPhysics::Newton::UpVector.set_accel(@address, value)
end

#dampNumeric

Note:

Higher damper makes rotation stronger.

Get angular damper.

Returns:

  • (Numeric)

Since:

  • 1.0.0



44
45
46
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 44

def damp
  MSPhysics::Newton::UpVector.get_damp(@address)
end

#damp=(value) ⇒ Object

Note:

Higher damper makes rotation stronger.

Set angular damper.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



51
52
53
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 51

def damp=(value)
  MSPhysics::Newton::UpVector.set_damp(@address, value)
end

#get_pin_dirGeom::Vector3d

Get desired pin direction with respect to joint orientation.

Returns:

  • (Geom::Vector3d)

Since:

  • 1.0.0



69
70
71
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 69

def get_pin_dir
  MSPhysics::Newton::UpVector.get_pin_dir(@address)
end

#set_pin_dir(pin_dir) ⇒ nil

Set desired pin direction with respect to joint orientation.

Parameters:

  • pin_dir (Geom::Vector3d)

Returns:

  • (nil)

Since:

  • 1.0.0



76
77
78
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 76

def set_pin_dir(pin_dir)
  MSPhysics::Newton::UpVector.set_pin_dir(@address, pin_dir)
end

#strengthNumeric

Get strength of the acceleration and damper.

Returns:

  • (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0



57
58
59
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 57

def strength
  MSPhysics::Newton::UpVector.get_strength(@address)
end

#strength=(value) ⇒ Object

Set strength of the acceleration and damper.

Parameters:

  • value (Numeric)

    A value between 0.0 and 1.0.

Since:

  • 1.0.0



63
64
65
# File 'RubyExtension/MSPhysics/joint_up_vector.rb', line 63

def strength=(value)
  MSPhysics::Newton::UpVector.set_strength(@address, value)
end