Class: MSPhysics::BodyContext

Inherits:
CommonContext show all
Defined in:
RubyExtension/MSPhysics/body_context.rb

Overview

BodyContext contains Body events and event-related functions.

Since:

  • 1.0.0

Simulation Events collapse

User Input Events collapse

Instance Method Summary collapse

Methods inherited from CommonContext

#accumulator, #delete_global_var, #delete_var, #frame, #get_global_var, #get_set_global_var, #get_set_var, #get_var, #joybutton, #joypad, #joystick, #key, #key_slider, #leftx, #lefty, #leftz, #numx, #numy, #oscillator, #oscillator2, #oscillator2_slope, #oscillator_slope, #repeater, #rightx, #righty, #rightz, #set_global_var, #set_var, #simulation, #singular_repeater, #slider, #toggle_key, #world

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(body) ⇒ BodyContext

Returns a new instance of BodyContext.

Parameters:

  • body (Body)

    A body to be associated with the context.

Since:

  • 1.0.0


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'RubyExtension/MSPhysics/body_context.rb', line 6

def initialize(body)
  @__body = body
  @__events = {
    :onStart                => nil,
    :onUpdate               => nil,
    :onPreUpdate            => nil,
    :onPostUpdate           => nil,
    :onTick                 => nil,
    :onPreFrame             => nil,
    :onPostFrame            => nil,
    :onEnd                  => nil,
    :onDraw                 => nil,
    :onPlay                 => nil,
    :onPause                => nil,
    :onTouch                => nil,
    :onTouching             => nil,
    :onUntouch              => nil,
    :onClick                => nil,
    :onDrag                 => nil,
    :onUnclick              => nil,
    :onKeyDown              => nil,
    :onKeyUp                => nil,
    :onKeyExtended          => nil,
    :onMouseMove            => nil,
    :onLButtonDown          => nil,
    :onLButtonUp            => nil,
    :onLButtonDoubleClick   => nil,
    :onRButtonDown          => nil,
    :onRButtonUp            => nil,
    :onRButtonDoubleClick   => nil,
    :onMButtonDown          => nil,
    :onMButtonUp            => nil,
    :onMButtonDoubleClick   => nil,
    :onXButton1Down         => nil,
    :onXButton1Up           => nil,
    :onXButton1DoubleClick  => nil,
    :onXButton2Down         => nil,
    :onXButton2Up           => nil,
    :onXButton2DoubleClick  => nil,
    :onMouseWheelRotate     => nil,
    :onMouseWheelTilt       => nil
  }

  super()
end

Instance Method Details

#call_event(event, *args) ⇒ Boolean

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.

Trigger an event.

Parameters:

  • event (Symbol, String)

    Event name.

  • args (*args)

    Event arguments.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'RubyExtension/MSPhysics/body_context.rb', line 131

def call_event(event, *args)
  evt = @__events[event.to_sym]
  return false unless evt
  begin
    evt.call(*args)
  rescue Exception => err
    ref = nil
    test = MSPhysics::SCRIPT_NAME + ':'
    err_message = err.message
    err_backtrace = err.backtrace
    unless AMS::IS_RUBY_VERSION_18
      err_message.force_encoding('UTF-8')
      err_backtrace.each { |i| i.force_encoding('UTF-8') }
    end
    err_backtrace.each { |location|
      if location.include?(test)
        ref = location
        break
      end
    }
    ref = err_message if !ref && err_message.include?(test)
    line = ref ? ref.split(test, 2)[1].split(/\:/, 2)[0].to_i : nil
    msg = "#{err.class.to_s[0] =~ /a|e|i|o|u/i ? 'An' : 'A'} #{err.class} has occurred while calling body #{event} event#{line ? ', line ' + line.to_s : nil}:\n#{err_message}"
    raise MSPhysics::ScriptException.new(msg, err_backtrace, @__body.group, line)
  end
  true
end

#eval_script(script, script_name, line) ⇒ Object

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.

Parameters:

  • script (String)
  • script_name (String)
  • line (Integer)

Since:

  • 1.0.0


56
57
58
# File 'RubyExtension/MSPhysics/body_context.rb', line 56

def eval_script(script, script_name, line)
  eval(script, binding, script_name, line)
end

#event_proc_assigned?(event) ⇒ Boolean

Determine whether particular event has a Proc object.

Parameters:

  • event (Symbol, String)

Returns:

  • (Boolean)

Since:

  • 1.0.0


122
123
124
# File 'RubyExtension/MSPhysics/body_context.rb', line 122

def event_proc_assigned?(event)
  @__events[event.to_sym] != nil
end

#get_event_proc(event) ⇒ Proc?

Get a Proc object assigned to an event.

Parameters:

  • event (Symbol, String)

Returns:

  • (Proc, nil)

    A Proc object or nil if there is no procedure to an event.

Since:

  • 1.0.0


99
100
101
# File 'RubyExtension/MSPhysics/body_context.rb', line 99

def get_event_proc(event)
  @__events[event.to_sym]
end

#on(*events) { ... } ⇒ Integer

Assign a block of code to an event or a list of events.

Examples:

on(:keyDown, :keyUp, :keyExtended) { |key, value, char|
  simulation.log_line(key)
}

Parameters:

  • events (Symbol, String)

Yields:

  • A block of code.

Returns:

  • (Integer)

    The number of events assigned.

Since:

  • 1.0.0


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'RubyExtension/MSPhysics/body_context.rb', line 74

def on(*events, &block)
  count = 0
  events.flatten.each { |evt|
    evt = evt.to_s.downcase
    evt.insert(0, 'on') if evt[0..1] != 'on'
    found = false
    @__events.each { |key, val|
      next if key.to_s.downcase != evt
      evt = key
      found = true
      break
    }
    next unless found
    @__events[evt] = block
    count += 1
  }
  state = @__events[:onTouch] || @__events[:onTouching] || @__events[:onUntouch]
  MSPhysics::Newton::Body.set_record_touch_data_state(@__body.address, state)
  count
end

#onClick {|point| ... } ⇒ Object

Assign a block of code to the onClick event.

Yields:

  • This event is triggered when the body is clicked.

Yield Parameters:

  • point (Geom::Point3d)

    Clicked position in global space.

Since:

  • 1.0.0


294
295
296
# File 'RubyExtension/MSPhysics/body_context.rb', line 294

def onClick(&block)
  set_event_proc(:onClick, block)
end

#onDrag { ... } ⇒ Object

Assign a block of code to the onDrag event.

Yields:

  • This event is triggered whenever the body is dragged by a mouse.

Since:

  • 1.0.0


300
301
302
# File 'RubyExtension/MSPhysics/body_context.rb', line 300

def onDrag(&block)
  set_event_proc(:onDrag, block)
end

#onDraw {|view, bb| ... } ⇒ Object

Assign a block of code to the onDraw event.

Examples:

onDraw { |view, bb|
  pts = [[0,0,100], [100,100,100]]
  # Add points to the view bounding box to prevent the line from being
  # clipped.
  bb.add(pts)
  # Now, draw the line in red.
  view.drawing_color = 'red'
  view.draw(GL_LINES, pts)
}

Yields:

  • This event is triggered whenever the view is redrawn, even when simulation is paused.

Yield Parameters:

  • view (Sketchup::View)
  • bb (Geom::BoundingBox)

Since:

  • 1.0.0


239
240
241
# File 'RubyExtension/MSPhysics/body_context.rb', line 239

def onDraw(&block)
  set_event_proc(:onDraw, block)
end

#onEnd { ... } ⇒ Object

Assign a block of code to the onEnd event.

Yields:

  • This event is triggered when simulation ends, right before the bodies are moved back to their starting transformation.

Since:

  • 1.0.0


220
221
222
# File 'RubyExtension/MSPhysics/body_context.rb', line 220

def onEnd(&block)
  set_event_proc(:onEnd, block)
end

#onKeyDown {|key, val, char| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onKeyDown event.

Yields:

  • This event is called when the key is pressed.

Yield Parameters:

  • key (String)

    Virtual key name.

  • val (Integer)

    Virtual key constant value.

  • char (String)

    Actual key character.

See Also:

Since:

  • 1.0.0


320
321
322
# File 'RubyExtension/MSPhysics/body_context.rb', line 320

def onKeyDown(&block)
  set_event_proc(:onKeyDown, block)
end

#onKeyExtended {|key, val, char| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onKeyExtended event.

Yields:

  • This event is called when the key is held down.

Yield Parameters:

  • key (String)

    Virtual key name.

  • val (Integer)

    Virtual key constant value.

  • char (String)

    Actual key character.

See Also:

Since:

  • 1.0.0


342
343
344
# File 'RubyExtension/MSPhysics/body_context.rb', line 342

def onKeyExtended(&block)
  set_event_proc(:onKeyExtended, block)
end

#onKeyUp {|key, val, char| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onKeyUp event.

Yields:

  • This event is called when the key is released.

Yield Parameters:

  • key (String)

    Virtual key name.

  • val (Integer)

    Virtual key constant value.

  • char (String)

    Actual key character.

See Also:

Since:

  • 1.0.0


331
332
333
# File 'RubyExtension/MSPhysics/body_context.rb', line 331

def onKeyUp(&block)
  set_event_proc(:onKeyUp, block)
end

#onLButtonDoubleClick {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onLButtonDoubleClick event.

Yields:

  • This event is called when the left mouse button is double clicked.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


378
379
380
# File 'RubyExtension/MSPhysics/body_context.rb', line 378

def onLButtonDoubleClick(&block)
  set_event_proc(:onLButtonDoubleClick, block)
end

#onLButtonDown {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onLButtonDown event.

Yields:

  • This event is called when the left mouse button is pressed.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


360
361
362
# File 'RubyExtension/MSPhysics/body_context.rb', line 360

def onLButtonDown(&block)
  set_event_proc(:onLButtonDown, block)
end

#onLButtonUp {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onLButtonUp event.

Yields:

  • This event is called when the left mouse button is released.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


369
370
371
# File 'RubyExtension/MSPhysics/body_context.rb', line 369

def onLButtonUp(&block)
  set_event_proc(:onLButtonUp, block)
end

#onMButtonDoubleClick {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onMButtonDoubleClick event.

Yields:

  • This event is called when the middle mouse button is double clicked.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


432
433
434
# File 'RubyExtension/MSPhysics/body_context.rb', line 432

def onMButtonDoubleClick(&block)
  set_event_proc(:onMButtonDoubleClick, block)
end

#onMButtonDown {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onMButtonDown event.

Yields:

  • This event is called when the middle mouse button is pressed.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


414
415
416
# File 'RubyExtension/MSPhysics/body_context.rb', line 414

def onMButtonDown(&block)
  set_event_proc(:onMButtonDown, block)
end

#onMButtonUp {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onMButtonUp event.

Yields:

  • This event is called when the middle mouse button is released.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


423
424
425
# File 'RubyExtension/MSPhysics/body_context.rb', line 423

def onMButtonUp(&block)
  set_event_proc(:onMButtonUp, block)
end

#onMouseMove {|x, y, view| ... } ⇒ Object

Assign a block of code to the onMouseMove event.

Yields:

  • This event is called when the mouse is moved.

Yield Parameters:

  • x (Integer)
  • y (Integer)
  • view (Sketchup::View)

Since:

  • 1.0.0


351
352
353
# File 'RubyExtension/MSPhysics/body_context.rb', line 351

def onMouseMove(&block)
  set_event_proc(:onMouseMove, block)
end

#onMouseWheelRotate {|x, y, dir| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onMouseWheelRotate event.

Yields:

  • This event is called when the mouse wheel is rotated.

Yield Parameters:

  • x (Integer)
  • y (Integer)
  • dir (Integer)

    Rotate direction: -1 - down, 1 - up.

Since:

  • 1.0.0


496
497
498
# File 'RubyExtension/MSPhysics/body_context.rb', line 496

def onMouseWheelRotate(&block)
  set_event_proc(:onMouseWheelRotate, block)
end

#onMouseWheelTilt {|x, y, dir| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onMouseWheelTilt event.

Yields:

  • This event is called when the mouse wheel is tilted.

Yield Parameters:

  • x (Integer)
  • y (Integer)
  • dir (Integer)

    Tilt direction: -1 - left, 1 - right.

Since:

  • 1.0.0


506
507
508
# File 'RubyExtension/MSPhysics/body_context.rb', line 506

def onMouseWheelTilt(&block)
  set_event_proc(:onMouseWheelTilt, block)
end

#onPause { ... } ⇒ Object

Assign a block of code to the onPause event.

Yields:

  • This event is triggered when simulation is paused.

Since:

  • 1.0.0


252
253
254
# File 'RubyExtension/MSPhysics/body_context.rb', line 252

def onPause(&block)
  set_event_proc(:onPause, block)
end

#onPlay { ... } ⇒ Object

Assign a block of code to the onPlay event.

Yields:

  • This event is triggered when simulation is played. It is not called when simulation starts.

Since:

  • 1.0.0


246
247
248
# File 'RubyExtension/MSPhysics/body_context.rb', line 246

def onPlay(&block)
  set_event_proc(:onPlay, block)
end

#onPostFrame { ... } ⇒ Object

Assign a block of code to the onPostFrame event.

Yields:

  • This event is triggered every time after the frame is changed, particularly after the ##onTick event.

Since:

  • 1.0.0


213
214
215
# File 'RubyExtension/MSPhysics/body_context.rb', line 213

def onPostFrame(&block)
  set_event_proc(:onPostFrame, block)
end

#onPostUpdate { ... } ⇒ Object

Assign a block of code to the onUpdate event.

Yields:

  • This event is triggered every time after the world is updated, particularly after the ##onUpdate event. Just like ##onUpdate, this event can be triggered multiple times per frame.

Since:

  • 1.0.0


191
192
193
# File 'RubyExtension/MSPhysics/body_context.rb', line 191

def onPostUpdate(&block)
  set_event_proc(:onPostUpdate, block)
end

#onPreFrame { ... } ⇒ Object

Assign a block of code to the onPreFrame event.

Yields:

  • This event is triggered every time before the frame is changed, particularly before the ##onTick event.

Since:

  • 1.0.0


206
207
208
# File 'RubyExtension/MSPhysics/body_context.rb', line 206

def onPreFrame(&block)
  set_event_proc(:onPreFrame, block)
end

#onPreUpdate { ... } ⇒ Object

Assign a block of code to the onPreUpdate event.

Yields:

  • This event is triggered every time before the world is updated, particularly before the ##onUpdate event. Just like ##onUpdate, this event can be triggered multiple times per frame.

Since:

  • 1.0.0


183
184
185
# File 'RubyExtension/MSPhysics/body_context.rb', line 183

def onPreUpdate(&block)
  set_event_proc(:onPreUpdate, block)
end

#onRButtonDoubleClick {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onRButtonDoubleClick event.

Yields:

  • This event is called when the right mouse button is double clicked.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


405
406
407
# File 'RubyExtension/MSPhysics/body_context.rb', line 405

def onRButtonDoubleClick(&block)
  set_event_proc(:onRButtonDoubleClick, block)
end

#onRButtonDown {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onRButtonDown event.

Yields:

  • This event is called when the right mouse button is pressed.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


387
388
389
# File 'RubyExtension/MSPhysics/body_context.rb', line 387

def onRButtonDown(&block)
  set_event_proc(:onRButtonDown, block)
end

#onRButtonUp {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onRButtonUp event.

Yields:

  • This event is called when the right mouse button is released.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


396
397
398
# File 'RubyExtension/MSPhysics/body_context.rb', line 396

def onRButtonUp(&block)
  set_event_proc(:onRButtonUp, block)
end

#onStart { ... } ⇒ Object

Assign a block of code to the onStart event.

Yields:

  • This event is triggered once when simulation starts, hence when the frame is zero. No world updates are made at this point.

Since:

  • 1.0.0


164
165
166
# File 'RubyExtension/MSPhysics/body_context.rb', line 164

def onStart(&block)
  set_event_proc(:onStart, block)
end

#onTick { ... } ⇒ Object

Assign a block of code to the onTick event.

Yields:

  • This event is triggered every time the frame is changed, specifically after all the world updates of the frame take place and after group transformations are updated.

Since:

  • 1.0.0


199
200
201
# File 'RubyExtension/MSPhysics/body_context.rb', line 199

def onTick(&block)
  set_event_proc(:onTick, block)
end

#onTouch {|toucher, point, normal, force, speed| ... } ⇒ Object

Assign a block of code to the onTouch event.

Yields:

  • This event is triggered when this body comes in contact with another body.

Yield Parameters:

  • toucher (Body)
  • point (Geom::Point3d)
  • normal (Geom::Vector3d)
  • force (Geom::Vector3d)

    in Newtons.

  • speed (Numeric)

    in meters per second.

Since:

  • 1.0.0


264
265
266
# File 'RubyExtension/MSPhysics/body_context.rb', line 264

def onTouch(&block)
  set_event_proc(:onTouch, block)
end

#onTouching {|toucher| ... } ⇒ Object

Assign a block of code to the onTouching event.

Yields:

  • This event is triggered every frame when the body is in an extended contact with another body.

Yield Parameters:

Since:

  • 1.0.0


272
273
274
# File 'RubyExtension/MSPhysics/body_context.rb', line 272

def onTouching(&block)
  set_event_proc(:onTouching, block)
end

#onUnclick { ... } ⇒ Object

Assign a block of code to the onUnclick event.

Yields:

  • This event is triggered when the body is unclicked.

Since:

  • 1.0.0


306
307
308
# File 'RubyExtension/MSPhysics/body_context.rb', line 306

def onUnclick(&block)
  set_event_proc(:onUnclick, block)
end

#onUntouch {|toucher| ... } ⇒ Object

Note:

Sometimes you may want to know whether particular body is in contact with another body. Relying on events is not always the best technique. To determine whether this body is in contact with another body, use this.touching_with?(some_other_body) or this.touching_bodies.

Assign a block of code to the onUntouch event.

Yields:

  • This event is triggered when particular body is no longer in contact with another body. When this procedure is triggered it doesn't always mean the body is free from all contacts. This means particular toucher has stopped touching the body.

Yield Parameters:

Since:

  • 1.0.0


287
288
289
# File 'RubyExtension/MSPhysics/body_context.rb', line 287

def onUntouch(&block)
  set_event_proc(:onUntouch, block)
end

#onUpdate { ... } ⇒ Object

Assign a block of code to the onUpdate event.

Yields:

  • This event is triggered every time the world is updated. For instance, if the world update rate is three, this event will be triggered three times per frame. For performance purposes, group transformations are not updated at this point. Only the transformations for the bodies referencing the groups are updated. This event is suitable for applying forces and velocities.

Since:

  • 1.0.0


175
176
177
# File 'RubyExtension/MSPhysics/body_context.rb', line 175

def onUpdate(&block)
  set_event_proc(:onUpdate, block)
end

#onXButton1DoubleClick {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton1DoubleClick event.

Yields:

  • This event is called when the X1 mouse button is double clicked.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


459
460
461
# File 'RubyExtension/MSPhysics/body_context.rb', line 459

def onXButton1DoubleClick(&block)
  set_event_proc(:onXButton1DoubleClick, block)
end

#onXButton1Down {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton1Down event.

Yields:

  • This event is called when the X1 mouse button is pressed.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


441
442
443
# File 'RubyExtension/MSPhysics/body_context.rb', line 441

def onXButton1Down(&block)
  set_event_proc(:onXButton1Down, block)
end

#onXButton1Up {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton1Up event.

Yields:

  • This event is called when the X1 mouse button is released.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


450
451
452
# File 'RubyExtension/MSPhysics/body_context.rb', line 450

def onXButton1Up(&block)
  set_event_proc(:onXButton1Up, block)
end

#onXButton2DoubleClick {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton2DoubleClick event.

Yields:

  • This event is called when the X2 mouse button is double clicked.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


486
487
488
# File 'RubyExtension/MSPhysics/body_context.rb', line 486

def onXButton2DoubleClick(&block)
  set_event_proc(:onXButton2DoubleClick, block)
end

#onXButton2Down {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton2Down event.

Yields:

  • This event is called when the X2 mouse button is pressed.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


468
469
470
# File 'RubyExtension/MSPhysics/body_context.rb', line 468

def onXButton2Down(&block)
  set_event_proc(:onXButton2Down, block)
end

#onXButton2Up {|x, y| ... } ⇒ Object

Note:

Windows only!

Assign a block of code to the onXButton2Up event.

Yields:

  • This event is called when the X2 mouse button is released.

Yield Parameters:

  • x (Integer)
  • y (Integer)

Since:

  • 1.0.0


477
478
479
# File 'RubyExtension/MSPhysics/body_context.rb', line 477

def onXButton2Up(&block)
  set_event_proc(:onXButton2Up, block)
end

#set_event_proc(event, proc) ⇒ Boolean

Assign a Proc object to an event.

Parameters:

  • event (Symbol, String)
  • proc (Proc, nil)

    A Proc object or nil to remove procedure from an event.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0


108
109
110
111
112
113
114
115
116
117
# File 'RubyExtension/MSPhysics/body_context.rb', line 108

def set_event_proc(event, proc)
  AMS.validate_type(proc, Proc, NilClass)
  return false unless @__events.keys.include?(event.to_sym)
  @__events[event.to_sym] = proc
  if event.to_s =~ /onTouch|onTouching|onUntouch/
    state = @__events[:onTouch] || @__events[:onTouching] || @__events[:onUntouch]
    MSPhysics::Newton::Body.set_record_touch_data_state(@__body.address, state)
  end
  true
end

#thisBody

Get the associated body.

Returns:

Since:

  • 1.0.0


62
63
64
# File 'RubyExtension/MSPhysics/body_context.rb', line 62

def this
  @__body
end