Class: MSPhysics::Contact

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

Overview

The Contact class represents an individual collision contact.

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(toucher, point, normal, force, speed) ⇒ Contact

Returns a new instance of Contact.

Parameters:

  • toucher (Body)
  • point (Geom::Point3d, Array<Numeric>)

    Contact point.

  • normal (Geom::Vector3d, Array<Numeric>)

    Contact normal.

  • force (Geom::Vector3d, Array<Numeric>)

    Contact force.

  • speed (Numeric)

    Contact speed.

Since:

  • 1.0.0



12
13
14
15
16
17
18
# File 'RubyExtension/MSPhysics/contact.rb', line 12

def initialize(toucher, point, normal, force, speed)
  @toucher = toucher
  @point = Geom::Point3d.new(point.to_a)
  @normal = Geom::Vector3d.new(normal.to_a).normalize
  @force = Geom::Vector3d.new(force.to_a)
  @speed = speed.to_f
end

Instance Attribute Details

#forceGeom::Vector3d (readonly)

Get contact force in Newtons.

Returns:

  • (Geom::Vector3d)

Since:

  • 1.0.0



# File 'RubyExtension/MSPhysics/contact.rb', line 32

#normalGeom::Vector3d (readonly)

Get contact normal.

Returns:

  • (Geom::Vector3d)

Since:

  • 1.0.0



# File 'RubyExtension/MSPhysics/contact.rb', line 28

#pointGeom::Point3d (readonly)

Get contact point.

Returns:

  • (Geom::Point3d)

Since:

  • 1.0.0



# File 'RubyExtension/MSPhysics/contact.rb', line 24

#speedNumeric (readonly)

Get contact speed in meters per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0



# File 'RubyExtension/MSPhysics/contact.rb', line 36

#toucherBody (readonly)

Get contact body.

Returns:

Since:

  • 1.0.0



# File 'RubyExtension/MSPhysics/contact.rb', line 20