Module: MSPhysics::Settings
- Defined in:
- RubyExtension/MSPhysics/settings.rb
Overview
Class Method Summary collapse
-
.aabb_visible=(state) ⇒ Object
Show/hide bodies’ axes aligned bounding box (AABB).
-
.aabb_visible? ⇒ Boolean
Determine whether bodies’ axes aligned bonding box (AABB) is visible.
-
.animate_scenes_delay ⇒ Numeric
Get the time to wait before starting to animate scenes.
-
.animate_scenes_delay=(value) ⇒ Object
Set the time to wait before starting to animate scenes.
-
.animate_scenes_reversed=(state) ⇒ Object
Reverse/normalize the animation of scenes.
-
.animate_scenes_reversed? ⇒ Boolean
Determine whether the animation of scenes is reversed.
-
.animate_scenes_state ⇒ Integer
Get the state of scenes animation.
-
.animate_scenes_state=(state) ⇒ Object
Set the state of scenes animation.
-
.axes_visible=(state) ⇒ Object
Show/hide bodies’ centre of mass axes.
-
.axes_visible? ⇒ Boolean
Determine whether bodies’ centre of mass axes are visible.
-
.bodies_visible=(state) ⇒ Object
Show/hide all bodies.
-
.bodies_visible? ⇒ Boolean
Determine whether bodies are visible.
-
.collision_wireframe_visible=(state) ⇒ Object
Show/hide bodies’ collision wireframe.
-
.collision_wireframe_visible? ⇒ Boolean
Determine whether bodies’ collision wireframe is visible.
-
.contact_forces_visible=(state) ⇒ Object
Show/hide bodies’ contact forces.
-
.contact_forces_visible? ⇒ Boolean
Determine whether bodies contact forces are visible.
-
.contact_points_visible=(state) ⇒ Object
Show/hide bodies’ contact points.
-
.contact_points_visible? ⇒ Boolean
Determine whether bodies’ contact points are visible.
-
.continuous_collision_check_enabled=(state) ⇒ Object
Enable/disable continuous collision check.
-
.continuous_collision_check_enabled? ⇒ Boolean
Determine whether continuous collision check is enabled.
-
.full_screen_mode_enabled=(state) ⇒ Object
Enable/disable fullscreen mode.
-
.full_screen_mode_enabled? ⇒ Boolean
Determine whether fullscreen mode is enabled.
-
.game_mode_enabled=(state) ⇒ Object
Enable/disable game mode.
-
.game_mode_enabled? ⇒ Boolean
Determine whether game mode is enabled.
-
.gravity ⇒ Numeric
Get simulation gravitational acceleration along Z-axis, in meters per second per second (m/s/s).
-
.gravity=(acceleration) ⇒ Object
Set simulation gravitational acceleration along Z-axis, in meters per second per second (m/s/s).
-
.hide_joint_layer_enabled=(state) ⇒ Object
Enable/disable the hide-joint-layer option.
-
.hide_joint_layer_enabled? ⇒ Boolean
Determine whether the hide-joint-layer option is enabled.
-
.ignore_hidden_instances=(state) ⇒ Object
Enable/disable fancy operation.
-
.ignore_hidden_instances? ⇒ Boolean
Determine whether hidden instances are ignored.
-
.joint_algorithm ⇒ Integer
Get joint solver model.
-
.joint_algorithm=(model) ⇒ Object
Set joint solver model.
-
.key_nav_atime ⇒ Numeric
Get the time to accelerate, in seconds, from zero to the desired velocity or omega.
-
.key_nav_atime=(value) ⇒ Object
Set the time to accelerate, in seconds, from zero to the desired velocity or omega.
-
.key_nav_omega ⇒ Numeric
Get the maximum omega of keyboard camera navigation in rad/s.
-
.key_nav_omega=(value) ⇒ Object
Set the maximum omega of keyboard camera navigation in rad/s.
-
.key_nav_state ⇒ Integer
Get the state of keyboard navigation.
-
.key_nav_state=(state) ⇒ Object
Set the state of keyboard navigation.
-
.key_nav_velocity ⇒ Numeric
Get the maximum velocity of keyboard camera navigation in m/s.
-
.key_nav_velocity=(value) ⇒ Object
Set the maximum velocity of keyboard camera navigation in m/s.
-
.keyboard_navigation_enabled=(state) ⇒ Object
Enable/disable the navigation of camera with keyboard.
-
.keyboard_navigation_enabled? ⇒ Boolean
Determine whether the navigation of camera with keyboard is enabled.
-
.load_options ⇒ Object
Load settings from registry.
-
.material_thickness ⇒ Numeric
Get simulation material thickness in meters.
-
.material_thickness=(thickness) ⇒ Object
Set simulation material thickness in meters.
-
.save_options ⇒ Object
Save settings to registry.
-
.solver_model ⇒ Integer
Get simulation solver model.
-
.solver_model=(model) ⇒ Object
Set simulation solver model.
-
.undo_on_end_enabled=(state) ⇒ Object
Enable/disable the undo-on-end option.
-
.undo_on_end_enabled? ⇒ Boolean
Determine whether the undo-on-end option is enabled.
-
.update_rate ⇒ Integer
Get simulation update rate, the number of times to update newton world per frame.
-
.update_rate=(rate) ⇒ Object
Set simulation update rate, the number of times to update newton world per frame.
-
.update_timestep ⇒ Numeric
Get simulation update timestep in seconds.
-
.update_timestep=(timestep) ⇒ Object
Set simulation update timestep in seconds.
Class Method Details
.aabb_visible=(state) ⇒ Object
Show/hide bodies’ axes aligned bounding box (AABB).
419 420 421 422 423 |
# File 'RubyExtension/MSPhysics/settings.rb', line 419 def aabb_visible=(state) @debug_aabb = state ? true : false sim = MSPhysics::Simulation.instance sim.aabb_visible = @debug_aabb if sim end |
.aabb_visible? ⇒ Boolean
Determine whether bodies’ axes aligned bonding box (AABB) is visible.
427 428 429 |
# File 'RubyExtension/MSPhysics/settings.rb', line 427 def aabb_visible? @debug_aabb end |
.animate_scenes_delay ⇒ Numeric
Get the time to wait before starting to animate scenes.
135 136 137 138 139 |
# File 'RubyExtension/MSPhysics/settings.rb', line 135 def animate_scenes_delay default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:animate_scenes_delay] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Animate Scenes Delay', default) return AMS.clamp(attr.to_f, 0, nil) end |
.animate_scenes_delay=(value) ⇒ Object
Set the time to wait before starting to animate scenes.
143 144 145 146 |
# File 'RubyExtension/MSPhysics/settings.rb', line 143 def animate_scenes_delay=(value) value = AMS.clamp(value.to_f, 0, nil) Sketchup.active_model.set_attribute('MSPhysics', 'Animate Scenes Delay', value) end |
.animate_scenes_reversed=(state) ⇒ Object
Reverse/normalize the animation of scenes.
158 159 160 161 |
# File 'RubyExtension/MSPhysics/settings.rb', line 158 def animate_scenes_reversed=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Animate Scenes Reversed', state) end |
.animate_scenes_reversed? ⇒ Boolean
Determine whether the animation of scenes is reversed.
150 151 152 153 154 |
# File 'RubyExtension/MSPhysics/settings.rb', line 150 def animate_scenes_reversed? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:animate_scenes_reversed] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Animate Scenes Reversed', default) return attr ? true : false end |
.animate_scenes_state ⇒ Integer
Get the state of scenes animation.
114 115 116 117 118 |
# File 'RubyExtension/MSPhysics/settings.rb', line 114 def animate_scenes_state default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:animate_scenes_state] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Animate Scenes State', default) return AMS.clamp(attr.to_i, 0, 3) end |
.animate_scenes_state=(state) ⇒ Object
Set the state of scenes animation.
126 127 128 129 130 131 |
# File 'RubyExtension/MSPhysics/settings.rb', line 126 def animate_scenes_state=(state) state = AMS.clamp(state.to_i, 0, 3) Sketchup.active_model.set_attribute('MSPhysics', 'Animate Scenes State', state) sim = MSPhysics::Simulation.instance sim.animate_scenes(state) if sim end |
.axes_visible=(state) ⇒ Object
Show/hide bodies’ centre of mass axes.
405 406 407 408 409 |
# File 'RubyExtension/MSPhysics/settings.rb', line 405 def axes_visible=(state) @debug_axes = state ? true : false sim = MSPhysics::Simulation.instance sim.axes_visible = @debug_axes if sim end |
.axes_visible? ⇒ Boolean
Determine whether bodies’ centre of mass axes are visible.
413 414 415 |
# File 'RubyExtension/MSPhysics/settings.rb', line 413 def axes_visible? @debug_axes end |
.bodies_visible=(state) ⇒ Object
Show/hide all bodies.
461 462 463 464 465 466 |
# File 'RubyExtension/MSPhysics/settings.rb', line 461 def bodies_visible=(state) @debug_bodies = state ? true : false sim = MSPhysics::Simulation.instance sim.bodies_visible = @debug_bodies if sim @debug_bodies end |
.bodies_visible? ⇒ Boolean
Determine whether bodies are visible.
470 471 472 |
# File 'RubyExtension/MSPhysics/settings.rb', line 470 def bodies_visible? @debug_bodies end |
.collision_wireframe_visible=(state) ⇒ Object
Show/hide bodies’ collision wireframe.
391 392 393 394 395 |
# File 'RubyExtension/MSPhysics/settings.rb', line 391 def collision_wireframe_visible=(state) @debug_collision = state ? true : false sim = MSPhysics::Simulation.instance sim.collision_wireframe_visible = @debug_collision if sim end |
.collision_wireframe_visible? ⇒ Boolean
Determine whether bodies’ collision wireframe is visible.
399 400 401 |
# File 'RubyExtension/MSPhysics/settings.rb', line 399 def collision_wireframe_visible? @debug_collision end |
.contact_forces_visible=(state) ⇒ Object
Show/hide bodies’ contact forces.
447 448 449 450 451 |
# File 'RubyExtension/MSPhysics/settings.rb', line 447 def contact_forces_visible=(state) @debug_contact_forces = state ? true : false sim = MSPhysics::Simulation.instance sim.contact_forces_visible = @debug_contact_forces if sim end |
.contact_forces_visible? ⇒ Boolean
Determine whether bodies contact forces are visible.
455 456 457 |
# File 'RubyExtension/MSPhysics/settings.rb', line 455 def contact_forces_visible? @debug_contact_forces end |
.contact_points_visible=(state) ⇒ Object
Show/hide bodies’ contact points.
433 434 435 436 437 |
# File 'RubyExtension/MSPhysics/settings.rb', line 433 def contact_points_visible=(state) @debug_contact_points = state ? true : false sim = MSPhysics::Simulation.instance sim.contact_points_visible = @debug_contact_points if sim end |
.contact_points_visible? ⇒ Boolean
Determine whether bodies’ contact points are visible.
441 442 443 |
# File 'RubyExtension/MSPhysics/settings.rb', line 441 def contact_points_visible? @debug_contact_points end |
.continuous_collision_check_enabled=(state) ⇒ Object
Enable/disable continuous collision check.
173 174 175 176 177 178 |
# File 'RubyExtension/MSPhysics/settings.rb', line 173 def continuous_collision_check_enabled=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Continuous Collision Mode', state) sim = MSPhysics::Simulation.instance sim.continuous_collision_check_enabled = state if sim end |
.continuous_collision_check_enabled? ⇒ Boolean
Determine whether continuous collision check is enabled.
165 166 167 168 169 |
# File 'RubyExtension/MSPhysics/settings.rb', line 165 def continuous_collision_check_enabled? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:continuous_collision_check] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Continuous Collision Mode', default) return attr ? true : false end |
.full_screen_mode_enabled=(state) ⇒ Object
Enable/disable fullscreen mode.
190 191 192 193 194 195 |
# File 'RubyExtension/MSPhysics/settings.rb', line 190 def full_screen_mode_enabled=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Fullscreen Mode', state) sim = MSPhysics::Simulation.instance sim.view_full_screen(state) if sim end |
.full_screen_mode_enabled? ⇒ Boolean
Determine whether fullscreen mode is enabled.
182 183 184 185 186 |
# File 'RubyExtension/MSPhysics/settings.rb', line 182 def full_screen_mode_enabled? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:full_screen_mode] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Fullscreen Mode', default) return attr ? true : false end |
.game_mode_enabled=(state) ⇒ Object
Enable/disable game mode.
237 238 239 240 241 242 |
# File 'RubyExtension/MSPhysics/settings.rb', line 237 def game_mode_enabled=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Game Mode', state) sim = MSPhysics::Simulation.instance sim.mode = (state ? 1 : 0) if sim end |
.game_mode_enabled? ⇒ Boolean
Determine whether game mode is enabled.
229 230 231 232 233 |
# File 'RubyExtension/MSPhysics/settings.rb', line 229 def game_mode_enabled? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:game_mode] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Game Mode', default) return attr ? true : false end |
.gravity ⇒ Numeric
Get simulation gravitational acceleration along Z-axis, in meters per second per second (m/s/s).
356 357 358 359 360 |
# File 'RubyExtension/MSPhysics/settings.rb', line 356 def gravity default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:gravity] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Gravity', default) return attr.to_f end |
.gravity=(acceleration) ⇒ Object
Set simulation gravitational acceleration along Z-axis, in meters per second per second (m/s/s).
365 366 367 368 369 370 |
# File 'RubyExtension/MSPhysics/settings.rb', line 365 def gravity=(acceleration) acceleration = acceleration.to_f Sketchup.active_model.set_attribute('MSPhysics', 'Gravity', acceleration) sim = MSPhysics::Simulation.instance sim.world.set_gravity(0, 0, acceleration) if sim end |
.hide_joint_layer_enabled=(state) ⇒ Object
Enable/disable the hide-joint-layer option.
254 255 256 257 258 259 260 261 |
# File 'RubyExtension/MSPhysics/settings.rb', line 254 def hide_joint_layer_enabled=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Hide Joint Layer', state) if MSPhysics::Simulation.instance layer = Sketchup.active_model.layers['MSPhysics Joints'] layer.visible = !state if layer && layer.visible? == state end end |
.hide_joint_layer_enabled? ⇒ Boolean
Determine whether the hide-joint-layer option is enabled.
246 247 248 249 250 |
# File 'RubyExtension/MSPhysics/settings.rb', line 246 def hide_joint_layer_enabled? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:hide_joint_layer] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Hide Joint Layer', default) return attr ? true : false end |
.ignore_hidden_instances=(state) ⇒ Object
Enable/disable fancy operation.
207 208 209 210 |
# File 'RubyExtension/MSPhysics/settings.rb', line 207 def ignore_hidden_instances=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Ignore Hidden Instances', state) end |
.ignore_hidden_instances? ⇒ Boolean
Determine whether hidden instances are ignored.
199 200 201 202 203 |
# File 'RubyExtension/MSPhysics/settings.rb', line 199 def ignore_hidden_instances? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:ignore_hidden_instances] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Ignore Hidden Instances', default) return attr ? true : false end |
.joint_algorithm ⇒ Integer
Get joint solver model.
299 300 301 302 303 |
# File 'RubyExtension/MSPhysics/settings.rb', line 299 def joint_algorithm default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:joint_algorithm] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Joint Algorithm', default) return AMS.clamp(attr.to_i, 0, 2) end |
.joint_algorithm=(model) ⇒ Object
Changing this property won’t have an effect until simulation is restarted.
Set joint solver model.
312 313 314 315 |
# File 'RubyExtension/MSPhysics/settings.rb', line 312 def joint_algorithm=(model) model = AMS.clamp(model.to_i, 0, 2) Sketchup.active_model.set_attribute('MSPhysics', 'Joint Algorithm', model) end |
.key_nav_atime ⇒ Numeric
Get the time to accelerate, in seconds, from zero to the desired velocity or omega.
93 94 95 96 97 98 99 |
# File 'RubyExtension/MSPhysics/settings.rb', line 93 def key_nav_atime if @settings.has_key?(:key_nav_atime) @settings[:key_nav_atime] else MSPhysics::DEFAULT_SIMULATION_SETTINGS[:key_nav_atime] end end |
.key_nav_atime=(value) ⇒ Object
Set the time to accelerate, in seconds, from zero to the desired velocity or omega.
104 105 106 |
# File 'RubyExtension/MSPhysics/settings.rb', line 104 def key_nav_atime=(value) @settings[:key_nav_atime] = AMS.clamp(value.to_f, 0.0, nil) end |
.key_nav_omega ⇒ Numeric
Get the maximum omega of keyboard camera navigation in rad/s.
76 77 78 79 80 81 82 |
# File 'RubyExtension/MSPhysics/settings.rb', line 76 def key_nav_omega if @settings.has_key?(:key_nav_omega) @settings[:key_nav_omega] else MSPhysics::DEFAULT_SIMULATION_SETTINGS[:key_nav_omega] end end |
.key_nav_omega=(value) ⇒ Object
Set the maximum omega of keyboard camera navigation in rad/s.
86 87 88 |
# File 'RubyExtension/MSPhysics/settings.rb', line 86 def key_nav_omega=(value) @settings[:key_nav_omega] = AMS.clamp(value.to_f, 0.01, nil) end |
.key_nav_state ⇒ Integer
Get the state of keyboard navigation.
42 43 44 45 46 |
# File 'RubyExtension/MSPhysics/settings.rb', line 42 def key_nav_state default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:key_nav_state] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Keyboard Nav State', default) return AMS.clamp(attr.to_i, 0, 2) end |
.key_nav_state=(state) ⇒ Object
Set the state of keyboard navigation.
53 54 55 56 |
# File 'RubyExtension/MSPhysics/settings.rb', line 53 def key_nav_state=(state) state = AMS.clamp(state.to_i, 0, 2) Sketchup.active_model.set_attribute('MSPhysics', 'Keyboard Nav State', state) end |
.key_nav_velocity ⇒ Numeric
Get the maximum velocity of keyboard camera navigation in m/s.
60 61 62 63 64 65 66 |
# File 'RubyExtension/MSPhysics/settings.rb', line 60 def key_nav_velocity if @settings.has_key?(:key_nav_velocity) @settings[:key_nav_velocity] else MSPhysics::DEFAULT_SIMULATION_SETTINGS[:key_nav_velocity] end end |
.key_nav_velocity=(value) ⇒ Object
Set the maximum velocity of keyboard camera navigation in m/s.
70 71 72 |
# File 'RubyExtension/MSPhysics/settings.rb', line 70 def key_nav_velocity=(value) @settings[:key_nav_velocity] = AMS.clamp(value.to_f, 0.01, nil) end |
.keyboard_navigation_enabled=(state) ⇒ Object
Enable/disable the navigation of camera with keyboard.
222 223 224 225 |
# File 'RubyExtension/MSPhysics/settings.rb', line 222 def (state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Keyboard Navigation', state) end |
.keyboard_navigation_enabled? ⇒ Boolean
Determine whether the navigation of camera with keyboard is enabled.
214 215 216 217 218 |
# File 'RubyExtension/MSPhysics/settings.rb', line 214 def default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:keyboard_navigation] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Keyboard Navigation', default) return attr ? true : false end |
.load_options ⇒ Object
Load settings from registry
27 28 29 30 31 32 33 34 35 |
# File 'RubyExtension/MSPhysics/settings.rb', line 27 def v = Sketchup.read_default('MSPhysics', 'Settings', '{}') begin res = eval(v) @settings.merge!(res) if res.is_a?(Hash) rescue Exception => e # Do nothing; use default options. end end |
.material_thickness ⇒ Numeric
Get simulation material thickness in meters.
374 375 376 377 378 |
# File 'RubyExtension/MSPhysics/settings.rb', line 374 def material_thickness default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:material_thickness] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Material Thickness', default) return AMS.clamp(attr.to_f, 0, 1/32.0) end |
.material_thickness=(thickness) ⇒ Object
Set simulation material thickness in meters.
382 383 384 385 386 387 |
# File 'RubyExtension/MSPhysics/settings.rb', line 382 def material_thickness=(thickness) thickness = AMS.clamp(thickness.to_f, 0, 1/32.0) Sketchup.active_model.set_attribute('MSPhysics', 'Material Thickness', thickness) sim = MSPhysics::Simulation.instance sim.world.material_thickness = thickness if sim end |
.save_options ⇒ Object
Save settings to registry
22 23 24 |
# File 'RubyExtension/MSPhysics/settings.rb', line 22 def Sketchup.write_default('MSPhysics', 'Settings', @settings.inspect.inspect[1..-2]) end |
.solver_model ⇒ Integer
Get simulation solver model.
282 283 284 285 286 |
# File 'RubyExtension/MSPhysics/settings.rb', line 282 def solver_model default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:solver_model] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Solver Model', default) return AMS.clamp(attr.to_i, 1, 256) end |
.solver_model=(model) ⇒ Object
Set simulation solver model.
290 291 292 293 294 295 |
# File 'RubyExtension/MSPhysics/settings.rb', line 290 def solver_model=(model) model = AMS.clamp(model.to_i, 1, 256) Sketchup.active_model.set_attribute('MSPhysics', 'Solver Model', model) sim = MSPhysics::Simulation.instance sim.world.solver_model = model if sim end |
.undo_on_end_enabled=(state) ⇒ Object
Enable/disable the undo-on-end option.
273 274 275 276 277 278 |
# File 'RubyExtension/MSPhysics/settings.rb', line 273 def undo_on_end_enabled=(state) state = state ? true : false Sketchup.active_model.set_attribute('MSPhysics', 'Undo on End', state) sim = MSPhysics::Simulation.instance sim.undo_on_reset = state if sim end |
.undo_on_end_enabled? ⇒ Boolean
Determine whether the undo-on-end option is enabled.
265 266 267 268 269 |
# File 'RubyExtension/MSPhysics/settings.rb', line 265 def undo_on_end_enabled? default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:undo_on_end] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Undo on End', default) return attr ? true : false end |
.update_rate ⇒ Integer
Get simulation update rate, the number of times to update newton world per frame.
337 338 339 340 341 |
# File 'RubyExtension/MSPhysics/settings.rb', line 337 def update_rate default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:update_rate] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Update Rate', default) return AMS.clamp(attr.to_i, 1, 100) end |
.update_rate=(rate) ⇒ Object
Set simulation update rate, the number of times to update newton world per frame.
346 347 348 349 350 351 |
# File 'RubyExtension/MSPhysics/settings.rb', line 346 def update_rate=(rate) rate = AMS.clamp(rate.to_i, 1, 100) Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate) sim = MSPhysics::Simulation.instance sim.update_rate = rate if sim end |
.update_timestep ⇒ Numeric
Get simulation update timestep in seconds.
319 320 321 322 323 |
# File 'RubyExtension/MSPhysics/settings.rb', line 319 def update_timestep default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:update_timestep] attr = Sketchup.active_model.get_attribute('MSPhysics', 'Update Timestep', default) return AMS.clamp(attr.to_f, 1/1200.0, 1/30.0) end |
.update_timestep=(timestep) ⇒ Object
Set simulation update timestep in seconds.
327 328 329 330 331 332 |
# File 'RubyExtension/MSPhysics/settings.rb', line 327 def update_timestep=(timestep) timestep = AMS.clamp(timestep.to_f, 1/1200.0, 1/30.0) Sketchup.active_model.set_attribute('MSPhysics', 'Update Timestep', timestep) sim = MSPhysics::Simulation.instance sim.update_timestep = timestep if sim end |