Class: MSPhysics::Material

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

Overview

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(name, density, static_friction, kinetic_friction, elasticity, softness) ⇒ Material

Returns a new instance of Material

Parameters:

  • name (String)

    Material name. Passing the name of an existing material will simply overwrite it.

  • density (Numeric)

    Material density in kilograms per cubic meter.

  • static_friction (Numeric)

    Static friction coefficient. This value is clamped between 0.01 and 2.00.

  • kinetic_friction (Numeric)

    Kinetic friction coefficient. This value is clamped between 0.01 and 2.00.

  • elasticity (Numeric)

    The coefficient of restitution. This is the rebound ratio. A basketball has a rebound ratio of 0.83. This means the new height of a basketball is 83% of original height within each bounce. This value is clamped between 0.01 and 2.00.

  • softness (Numeric)

    The softness coefficient. Decreasing softness yields adaptable collision. Increasing softness yields resistible collision. This value is clamped between 0.01 and 1.00. Typical value is 0.15.

Since:

  • 1.0.0

Instance Method Details

#densityNumeric

Get material density in kilograms per cubic meter (kg/m^3).

Returns:

  • (Numeric)

Since:

  • 1.0.0

#density=(value) ⇒ Object

Set material density in kilograms per cubic meter (kg/m^3).

Parameters:

  • value (Numeric)

Since:

  • 1.0.0

#elasticityNumeric

Get material coefficient of restitution - bounciness.

Returns:

  • (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0

#elasticity=(coefficient) ⇒ Object

Set material coefficient of restitution - bounciness.

Parameters:

  • coefficient (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0

#equals?(other_material) ⇒ Boolean

Determine whether thi material has the same properties as another material.

Parameters:

Returns:

  • (Boolean)

Since:

  • 1.0.0

#kinetic_frictionNumeric

Get material kinetic friction coefficient.

Returns:

  • (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0

#kinetic_friction=(coefficient) ⇒ Object

Set material kinetic friction coefficient.

Parameters:

  • coefficient (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0

#nameString

Get material name.

Returns:

  • (String)

Since:

  • 1.0.0

#softnessNumeric

Get material softness coefficient.

Returns:

  • (Numeric)

    A value between 0.01 and 1.00.

Since:

  • 1.0.0

#softness=(coefficient) ⇒ Object

Set material softness coefficient.

Parameters:

  • coefficient (Numeric)

    A value between 0.01 and 1.00.

Since:

  • 1.0.0

#static_frictionNumeric

Get material static friction coefficient.

Returns:

  • (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0

#static_friction=(coefficient) ⇒ Object

Set material static friction coefficient.

Parameters:

  • coefficient (Numeric)

    A value between 0.01 and 2.00.

Since:

  • 1.0.0