Class: MSPhysics::Plane

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

Overview

Since:

  • 1.0.0

Constant Summary collapse

DEFAULT_LINEAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ANGULAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ROTATION_ENABLED =

Since:

  • 1.0.0

false

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

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



17
18
19
20
21
22
23
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 17

def initialize(world, parent, pin_tra, group = nil)
  super(world, parent, pin_tra, group)
  MSPhysics::Newton::Plane.create(@address)
  MSPhysics::Newton::Plane.set_linear_friction(@address, DEFAULT_LINEAR_FRICTION)
  MSPhysics::Newton::Plane.set_angular_friction(@address, DEFAULT_ANGULAR_FRICTION)
  MSPhysics::Newton::Plane.enable_rotation(@address, DEFAULT_ROTATION_ENABLED)
end

Instance Method Details

#angular_frictionNumeric

Get rotation friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



39
40
41
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 39

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

#angular_friction=(value) ⇒ Object

Set rotation friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



45
46
47
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 45

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

#linear_frictionNumeric

Get movement friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0



27
28
29
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 27

def linear_friction
  MSPhysics::Newton::Plane.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



33
34
35
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 33

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

#rotation_enabled=(state) ⇒ Object

Enable/disable the rotation along the connected body’s center of mass and the plane’s Z-axis.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0



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

def rotation_enabled=(state)
  MSPhysics::Newton::Plane.enable_rotation(@address, state)
end

#rotation_enabled?Boolean

Determine whether the rotation along the connected body’s center of mass and the plane’s Z-axis is enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0



52
53
54
# File 'RubyExtension/MSPhysics/joint_plane.rb', line 52

def rotation_enabled?
  MSPhysics::Newton::Plane.rotation_enabled?(@address)
end