Class: MSPhysics::CommonContext
- Defined in:
- RubyExtension/MSPhysics/common_context.rb
Overview
CommonContext contains methods that both BodyContext and ControllerContext objects have in common.
Direct Known Subclasses
Variables collapse
-
#delete_global_var(name) ⇒ Boolean
Remove global variable from hash.
-
#delete_var(name) ⇒ Boolean
Remove variable from hash.
-
#get_global_var(name) ⇒ Object
Get global variable value.
-
#get_set_global_var(name, value) ⇒ Object
Get original global variable value and assign a new value.
-
#get_set_var(name, value) ⇒ Object
Get original variable value and assign a new value.
-
#get_var(name) ⇒ Object
Get variable value.
-
#set_global_var(name, value) ⇒ Object
Set global variable value.
-
#set_var(name, value) ⇒ Object
Set variable value.
Instances collapse
-
#simulation ⇒ Simulation
Get Simulation instance.
-
#world ⇒ World
Get simulation World instance.
Time collapse
-
#frame ⇒ Fixnum
Get simulation frame.
User Input collapse
-
#joybutton(button) ⇒ Fixnum
Get joy-button value.
-
#joypad ⇒ Fixnum
Get joy-pad value.
-
#joystick(axis) ⇒ Numeric
Get joystick value.
-
#key(vk) ⇒ Fixnum
Get state of a keyboard key.
-
#key_slider(name, key1, key2, default_value = 0.0, min = 0.0, max = 1.0, step = 1.0) ⇒ Numeric
Create a new range slider or get slider value if slider with the specified name already exists.
-
#leftx ⇒ Numeric
Output from keys D and A or X-axis position on the left joystick.
-
#lefty ⇒ Numeric
Output from keys W and S or Y-axis position on the left joystick.
-
#leftz ⇒ Numeric
Output from keys E and Q or position of the joy controller's left trigger.
-
#numx ⇒ Fixnum
Output from keys NUMPAD6 and NUMPAD4 or centered-X-axis position on the joy-pad.
-
#numy ⇒ Fixnum
Output from keys NUMPAD8 and NUMPAD5 or centered-Y-axis position on the joy-pad.
-
#rightx ⇒ Numeric
Output from LEFT and RIGHT arrow keys or X-axis position on the right joystick.
-
#righty ⇒ Numeric
Output from UP and DOWN arrow keys or Y-axis position on the right joystick.
-
#rightz ⇒ Numeric
Output from keys PageUp and PageDown or position of the joy controller's right trigger.
-
#slider(name, default_value = 0.0, min = 0.0, max = 1.0, step = 1.0) ⇒ Numeric
Create a new range slider or get slider value if slider with the specified name already exists.
-
#toggle_key(vk) ⇒ Fixnum
Get toggled state of a keyboard key.
Functions collapse
-
#accumulator(rate, delay = 0.0) ⇒ Fixnum
Increment the accumulator by one at a specific rate and offset.
-
#oscillator(frequency, delay = 0.0) ⇒ Numeric
Calculate the value of a sine curve at a particular world time.
-
#oscillator2(frequency, delay = 0.0) ⇒ Numeric
Compute the value of a shifted sine curve at a particular world time.
-
#oscillator2_slope(frequency, delay = 0.0) ⇒ Numeric
Calculate the slope of a shifted sine curve at a particular world time.
-
#oscillator_slope(frequency, delay = 0.0) ⇒ Numeric
Calculate the slope of a sine curve at a particular world time.
-
#repeater(rate, hold, delay = 0.0) ⇒ Fixnum
Compute a repeater value based on rate, hold, and delay.
-
#singular_repeater(rate, delay = 0.0, id = nil) ⇒ Fixnum
Compute a repeater value based on rate and delay that repeats only one time whenever it is triggered.
Instance Method Summary collapse
-
#initialize ⇒ CommonContext
constructor
A new instance of CommonContext.
Methods inherited from Entity
Constructor Details
#initialize ⇒ CommonContext
Returns a new instance of CommonContext
Instance Method Details
#accumulator(rate, delay = 0.0) ⇒ Fixnum
Increment the accumulator by one at a specific rate and offset.
#delete_global_var(name) ⇒ Boolean
Remove global variable from hash.
#delete_var(name) ⇒ Boolean
Remove variable from hash.
#frame ⇒ Fixnum
Get simulation frame.
#get_global_var(name) ⇒ Object
These variables are accessible in all body/controller scopes and exist throughout the session of the SketchUp process. They are preserved after simulation ends.
Get global variable value.
#get_set_global_var(name, value) ⇒ Object
These variables are accessible in all body/controller scopes and exist throughout the session of the SketchUp process. They are preserved after simulation ends.
Get original global variable value and assign a new value.
#get_set_var(name, value) ⇒ Object
These variables are accessible in all body/controller scopes and exist only throughout the session of simulation. They are disposed of after simulation ends.
Get original variable value and assign a new value.
#get_var(name) ⇒ Object
These variables are accessible in all body/controller scopes and exist only throughout the session of simulation. They are disposed of after simulation ends.
Get variable value.
#joybutton(button) ⇒ Fixnum
Button name parameter is not case sensitive.
Get joy-button value.
#joypad ⇒ Fixnum
Get joy-pad value.
-
0if hat is centered -
1if hat is up -
2if hat is right -
4if hat is down -
8if hat is left -
12if hat is left-down -
9if hat is left-up -
6if hat is right-down -
3if hat is right-up
#joystick(axis) ⇒ Numeric
Axis name parameter is not case sensitive.
Get joystick value.
#key(vk) ⇒ Fixnum
The vk parameter is not case sensitive.
Get state of a keyboard key.
#key_slider(name, key1, key2, default_value = 0.0, min = 0.0, max = 1.0, step = 1.0) ⇒ Numeric
Create a new range slider or get slider value if slider with the specified name already exists.
#leftx ⇒ Numeric
Output from keys D and A or X-axis position on the left joystick.
#lefty ⇒ Numeric
Output from keys W and S or Y-axis position on the left joystick.
#leftz ⇒ Numeric
Output from keys E and Q or position of the joy controller's left trigger.
#numx ⇒ Fixnum
Output from keys NUMPAD6 and NUMPAD4 or centered-X-axis position on the joy-pad.
#numy ⇒ Fixnum
Output from keys NUMPAD8 and NUMPAD5 or centered-Y-axis position on the joy-pad.
#oscillator(frequency, delay = 0.0) ⇒ Numeric
Calculate the value of a sine curve at a particular world time.
#oscillator2(frequency, delay = 0.0) ⇒ Numeric
Compute the value of a shifted sine curve at a particular world time.
#oscillator2_slope(frequency, delay = 0.0) ⇒ Numeric
Calculate the slope of a shifted sine curve at a particular world time.
#oscillator_slope(frequency, delay = 0.0) ⇒ Numeric
Calculate the slope of a sine curve at a particular world time.
#repeater(rate, hold, delay = 0.0) ⇒ Fixnum
Compute a repeater value based on rate, hold, and delay.
#rightx ⇒ Numeric
Output from LEFT and RIGHT arrow keys or X-axis position on the right joystick.
#righty ⇒ Numeric
Output from UP and DOWN arrow keys or Y-axis position on the right joystick.
#rightz ⇒ Numeric
Output from keys PageUp and PageDown or position of the joy controller's right trigger.
#set_global_var(name, value) ⇒ Object
These variables are accessible in all body/controller scopes and exist throughout the session of the SketchUp process. They are preserved after simulation ends.
Set global variable value.
#set_var(name, value) ⇒ Object
These variables are accessible in all body/controller scopes and exist only throughout the session of simulation. They are disposed of after simulation ends.
Set variable value.
#simulation ⇒ Simulation
Get Simulation instance.
#singular_repeater(rate, delay = 0.0, id = nil) ⇒ Fixnum
Compute a repeater value based on rate and delay that repeats only one time whenever it is triggered.
#slider(name, default_value = 0.0, min = 0.0, max = 1.0, step = 1.0) ⇒ Numeric
Create a new range slider or get slider value if slider with the specified name already exists.
#toggle_key(vk) ⇒ Fixnum
The vk parameter is not case sensitive.
Get toggled state of a keyboard key.