Sketchup plugin – SketchyPhysics
SketchyPhysics is een gratis en unieke plug-in voor SketchUp Pro. Het programma kan objecten laten bewegen, vallen, roteren, etc.
Sketchup compatibiliteit:
SketchyPhysics v3.1, v3.2, v3.5.6 (getest) voor SketchUp 8
SketchyPhysics v3.3.0+ voor SketchUp 2014 en Sketchup 2015 (32-bit)
Werk NIET met Sketchup 2015 64-bit!
Download SketchyPhysics2 @Â Google Code
Download SketchyPhysics3 voor SketchUp 8 @Â Google Code
Download SketchyPhysics3 voor SketchUp 2014/2015 @ Google Drive
Download SketchyPhysics 3.6.0 @ Sketchucation forum
Download SketchyPhysics 3.7.0+ @Â 5mp.eu
Installatie van Sketchup plugins/tools/libraries: Sketchup info
Interactief met de buitenwereld communiceren via SketchUp SketchyPhysics? bekijk het voorbeeld script!
Events
Events are defined in the Scripted field in the UI.
- ontouch
1 2 3 4 |
#Event is triggered when body is touched by another. ontouch{|toucher,position,speed| logLine("I was touched") } |
- ontouching
1 2 3 4 |
#Event is triggered every tick as long as bodies are in contact. ontouching{|toucher| logLine("Still touching") } |
- onuntouch
1 2 3 4 |
#Event is triggered when bodies stop touching. onuntouch{|toucher| logLine("Done touching") } |
- onstart
1 2 3 4 |
#Event is triggered once at the beginning of the simulation. onstart{ logLine("Start") } |
- onend
1 2 3 4 |
#Event is triggered once at the end of the simulation. onend{ logLine("End") } |
- onpreframe
1 2 3 4 |
#Event is called at the end of each frame after the physics simulation step onpreframe{ logLine("Postframe") } |
- ontick
1 2 3 4 |
#Event is once per frame just before the physics simulation step. ontick{ logLine("Tick") } |
- onpostframe
1 2 3 4 |
#Event is once per frame just before the physics simulation step. ontick{ logLine("Tick") } |
- onclick
1 2 3 4 |
#Event is called when the user mouse clicks a body. onclick{ logLine("Click") } |
- ondrag
1 2 3 4 |
#Event is called each frame the user holds the mouse button after clicking. ondrag{ logLine("Dragging") } |
- onupdate (not documented)
1 2 3 4 |
#Event is called when the the model is moving? onupdate{ logLine("Model update...") } |
- onunclick
1 2 3 4 |
#Event is called when the user releases the mouse button after clicking. ondrag{ logLine("Unclick") } |
Script functions
Simulation variables
Varibles are used to communicate between fields and bodies. Setting a variable in the scripted field and reading it in a controller field for example.
- setVar(name,value)
- getVar(name)
- getSetVar(name,value=0)#shortcut function that allows you to get the current value and set it at the same time.
Inputs
Inputs return a value depending on the state of the key/joystick etc. For example key(“space”) returns 1.0 if the space key is down 0.0 if it is not.
- key(name)
- joy(name)
- joybutton(name)
- slider(sname,defaultValue=0.5,min=0.0,max=1.0)
Physics body
These functions change the physics body as described.
- magnetic=true/false
- nocollision=true/false
- solid=true/false
- push(direction)
- getVelocity()
- setVelocity(velocity).
1 2 3 4 5 6 7 8 9 |
•setVelocity(velocity). # setVelocity takes a vector that is the direction the object will #be moving and the length of the vector is how fast. It is different #from push because it actually sets the objects velocity rather than #just try to push it. onstart{ setVector([0,0,10]) #set object to moving straight up at speed 10 } |
- setLinearDamping(damp)
- setAngularDamping(damp)
- getTorque()
- setTorque(torque).
1 2 3 4 5 |
#setTorque does the same thing as setVelocity but with the objects #rotation onstart{ setTorque([0,0,10])#spin object around blue axis } |
- destroy()
- teleport(pos,recurse=true)
- copy(pos=nil,velocity=nil,lifetime=0)
- split(bdy=self,recurse=0)
- setCamera()
Joints
- createJoint(parent,child,type=”ball”,min=0,max=0,accel=0,damp=0,breakingForce=0)
- disconnect()
- attach(child,breakingForce=0)#shortcut that creates a fixed joint connection to child
- connect(child,type=”ball”,min=0,max=0,accel=0,damp=0,breakingForce=0)#shortcut for createJoint that uses the current body as the parent.
- lookAt(target,stiff=10.0,damp=10.0)
Utility
- playSound(name)#play an embedded sound. See SoundUI.
- logLine(str)#put a message on the screen.
- frame()#get current frame
- group()#get current Sketchup group
- camera()#get the Sketchup camera
- position()#get the current position of the body
- transformation()#get the current transformation of the body.
- simulation()#get the simulation object(seldom used)
- evalCurveAbs(name,dist)
- getCurveLength(curveVerts)
- findCurve(name)
1 2 3 4 5 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 |
3.7.3 > Fixed Mac OS X crash (Thanks the feedback from Anton Synytsia). 3.7.2 > June 25, 2016 > Integrated new Export animation by Anton Synytsia. > New Windows installer. > Fixed some bugs. 3.7.1 > December 23, 2015 > Fixed the theme selector in script editor panel. From now just 2 theme is available.(Light, Dark) > Added raytest(point, vector). This create a ray. point: Geom::Point3d or numeric array vector: Geom::Vector3d or numeric array Return: Sketchup.active_model.raytest(point, vector) OR false if nil > Added findBodyByRaytest(ray). This find a body on collision of raytest. ray: raytest Return: body [SP3xBodyContext] > Added findPointByRaytest(ray). This find a point on collision of raytest. ray: raytest Return: Geom::Point3d > Added addImpulse(body, point, vector, strength = 1). Add impulse to body on collision of the raytest. Point and vector must be the same as the raytest values. body: [SP3xBodyContext] point: raytest point vector: raytest vector strength: numeric Video on YouTube onStart { @box = findBody("box") } onUpdate { point = @box.getOrigin # ERASE THE BOX FACE ON GREEN AXIS ! vector = @box.getAxes.y ray = raytest(point, vector) if key('v') == 1 target_body = findBodyByRaytest(ray) addImpulse(target_body, point, vector) end } > Changed the 'visibleAll' command to 'visibility' 3.7.0 > December 12, 2015 > Added Entity Info table into Inspector. This get the all entity ID and index. Video on YouTube > Fixed the javascript fault in SUp 13. (If opened the Settings UI and double-click onto group). > Added findLayer(value) alias to getLayer(value) v. 3.6.0 value: name- or index of layer Return: layer > Added findEntityByIndex(index) alias to getEntity(index) v. 3.6.0 Return: entity > Added findEntityById(id) id: ID of entity OR ID of internal entity in the group/component Return: entity > Added findGroupByName(name) Find just group/component by name. name: name of group/component OR name of internal group/component in the group/component Return: entity > Added visibility(value, state) value: entity, layer or body state: true/false boolean. Default is false. Return: state ? (value.visible = true unless value.visible?) : (value.visible = false if value.visible?) onStart { @entity_1 = findEntityByIndex(0) @entity_2 = findEntityById(103) @entity_3 = findGroupByName("sphere") @layer_1 = findLayer(1) @layer_2 = findLayer("Physics joints") @body_1 = findBody("sphere") @body_2 = findBody(group_entity) } onUpdate { state = true if key('v') == 1 visibility(@entity_1, state) visibility(@layer_1, state) visibility(@body_1, state) OR @state = true if key('v') == 1 @state = false if key('n') == 1 visibility(@entity_1, @state) visibility(@layer_1, @state) visibility(@body_1, @state) } 3.6.9 > December 7, 2015 > Fixed the Settings dialog html and javascript file. > Added security alert to getMouseAxes, setSphereAxes, getEntity, getLayer, visibleEntity, visibleLayer commands. > Improved the script editor panel. Copy-paste function is working. New themes: SP Light and SP Dark. The SketchyPhysics keywords is yellow. 3.6.8 > November 26, 2015 > Compatible with SketchUp 2016 32-bit. New hand icon in simulation because old does not working. Fixed the Prims and Joints toolbar check function. New style and icons. > Fixed model version checking. Now if the model SketchyPhysics version is subsequent like the installed SP, then appears a window from which be downloaded the latest version. > Fixed Ace editor theme changer. From now remember onto selected theme. > Fixed Menu in Settings dialog. From now remember onto selected menu. > Settings dialog is closed during the simulation. > The last selected group will be memorized before start the simulation. Re-selected if stopped the simulation. > Added Joints hide checkbox to Inspector. This hide all Joints during the simulation. > Added Controller Panel hide checkbox to Inspector. This hide the Joints Controller Panel during the simulation. > Added 'Purge Unused' button to Inspector. This cleans the model.(materials, styles, definitions, layers) > Added 'Delete Guides' button to Inspector. This delete all guide points and guidelines. When you're done with the model, you can delete all guides point from joints. If there are many joints in the model, this improves the performance! > Added 'Clear Ruby Console' button to script editor panel. (SketchUp 2014+) > Added visibleLayer(value, state) command. value = index- or name of layer state = true/false boolean Source: layer = Sketchup.active_model.layers[value] state ? (layer.visible = true unless layer.visible?) : (layer.visible = false if layer.visible?) onUpdate { vis_layer_bool = true if key('v') == 1 visibleLayer("Physics joints", vis_layer_bool) OR @vis_layer_bool = true if key('v') == 1 @vis_layer_bool = false if key('n') == 1 visibleLayer("Physics joints", @vis_layer_bool) } > Added visibleEntity(index, state) > Added visibleBody(body, state) body = physics group/component state = true/false boolean onStart { @body = findBody("sphere") } onUpdate { vis_body_bool = true if key('v') == 1 visibleBody(@body, vis_body_bool) OR @vis_body_bool = true if key('v') == 1 @vis_body_bool = false if key('n') == 1 visibleBody(@body, @vis_body_bool) } > Added resetSimulation alias to physicsReset; and startSimulation to physicsStart v 3.6.4. > Fixed the newPoint and newVector command. 3.6.7 > November 2, 2015 > Added new Ace Code Editor. The copy and paste function is not working! Hold the Ctrl/Command and drag the selected text to place. Copy and paste from external editor in the Inspector script box. 3.6.6 > November 2, 2015 > Added new sound player command with stereo and multi functions: SP3xCommonContext.playSoundPro( channel, "sound", position, volume, play, stop, ch_reset, repeat, time Required! Required! Required! Optional Optional Optional Optional Optional Optional Default = 5 Default = false Default = false Default = false Default = 0 Default = -1 @channel_1 = playSoundPro(@channel_1, .....) Sound name. 3D point or array. Sound volume. Play sound: true/false boolean. Stop sound and reset channel: true/false boolean. Reset channel: true/false boolean. Repeat sound. Playback length in milliseconds. ) Note: The channel is automatic resets, if non playing the sound. #============================================================ # Version 1: Background music #============================================================ onUpdate { @channel_1 = playSoundPro( @channel_1, "background_music", camera.eye, # Sound sources is camera centre point. 5, frame == 1, # Play music if simulation frame is 1. false, # No stop. false, # No channel reset. 999 # Repeat. ) } #============================================================ # Version 2: Car horn. #============================================================ onStart { @car = findBody("car") } onUpdate { if key('v') == 1 play = true if @channel_horn == nil else stop = true end @channel_horn = playSoundPro( @channel_horn, "car_horn", @car.getCenter, 4, play, stop ) } #============================================================ # Version 3: Play sound one by one. #============================================================ onStart { @body = findBody("sphere") } onUpdate { play = true if key('v') == 1 and @channel_3 == nil @channel_3 = playSoundPro( @channel_3, "sound", @body.getCenter, 4, play ) } #============================================================ # Version 4: Play sound with each key press. #============================================================ onStart { @body = findBody("sphere") } onUpdate { if key('v') == 1 play = true if @asdda == nil @asdda = true else @asdda = nil end @channel_4 = playSoundPro( @channel_4, "sound", @body.getCenter, 5, play ) } #============================================================ # Version 5: Gun shot. #============================================================ onStart { @gun = findBody("sphere") } onUpdate { play = true if key('v') == 1 and every(7) @channel_5 = playSoundPro( @channel_5, "gunShot_4", @gun.getCenter, 5, play, false, # No stop true # Channel is nil, if 'play' no true. ) } Note: If you use more gun shots, you can use this: every(7,0) for 1 gun every(7,1) for 2 gun every(7,2) for 3 gun etc ... The second number should be less than the first! > Added playback sound detector. SP3xCommonContext.playing?(channel) Returns: true/false boolean. onUpdate { @channel_1 = playSound("activation_1") if key('v') == 1 and @channel == nil # This resets the sound channel. Required to setSoundPosition/2/ ! (@channel_1 = nil unless playing?(@channel_1)) if @channel_1 (@channel_85 = nil unless playing?(@channel_85)) if @channel_85 # etc.... # Turn it On/Off the joints with sound. if @channel_1 playing?(@channel_1) ? setVar('variable',1) : setVar('variable',0) end } > Added set maximum channels in numbers. Default is 8, max is 100. SP3xCommonContext.maxChannels(numeric) onStart { maxChannels(30) } > Added frame counter with allocation. Count default is 0. SP3xCommonContext.every(allocation, count) Returns: true/false boolean. Source: frame % allocation == count onUpdate { @channel_1 = playSound("activation_1") if key('v') == 1 and every(30) @channel_2 = playSound("activation_2") if key('n') == 1 and every(30,10) } 3.6.5 > October 24, 2015 > Fixed SketchUp 2013 start simulation crash. > Fixed setSphereAxes command. > Improved transition command. 3.6.4 > October 22, 2015 > Added follower camera command to vehicles. SP3xBodyContext.followerCamera( distance, speed, front height, rear height, field of view Required! Optional Optional Optional Optional Default = 20 Default = 10 Default = 50 Default = 40 ) Video on YouTube > Added new menu item ("Camera Follow and Track") into right click context menu during simulation. > Added origin point modifier (setBodyOrigin) to multiple shapes are selected. > Added physicsReset command to stop and reset physics simulation. SP3xBodyContext.physicsReset Returns: MSketchyPhysics3::SketchyPhysicsClient.safePhysicsReset onUpdate { physicsReset if key('v') == 1 } > Added physicsStart command to start physics simulation. SP3xBodyContext.physicsStart Returns: MSketchyPhysics3::SketchyPhysicsClient.physicsStart onUpdate { if key('v') == 1 timer = UI.start_timer(0.2, false) { UI.stop_timer(timer) physicsStart } physicsReset end } > Added group/component finder by name to body commands. SP3xBodyContext.findBody(value) value: name of group/component OR entity Returns: @simulation.findBody(value) onStart { @entity_1 = getEntity(1) @body_1 = findBody(@entity_1) OR @body_1 = findBody("sphere") } onUpdate { @body_1.setVelocity([0,1,0]) } 3.6.3 > October 20, 2015 > Sounds dialog is integrated into Settings dialog. > Added for shapes body origin changer command. This changes the origin point to body center point. Only in this way will be correct the friction. > Fixed the Joint-Properties and connection tool.rb. Connect joint to body: Hold the left Ctrl, click the joint then click the body. Disconnect: Hold the left Shift, no matter what the order. <-> > Fixed the getFps command. > Fixed the setSphereAxes command. > Added update checker in "Extensions -> SketchyPhysics -> Check the new version" > Added Ruby Console cleaner command into sp_tool.rb. Returns: SKETCHUP_CONSOLE.clear 3.6.2 > October 14, 2015 > Added hide Joint Controller Panel command: SP3xCommonContext.hiddenControllerPanel (The getMouseAxes command automatically hides the controller panel.) onStart { hiddenControllerPanel } > Fixed the controller_commands.rb. > Fixed the physicsStart command in sp_tool.rb. Now open the Joint Controller Panel. > Added oscillator command: SP3xCommonContext.oscillator(num) (num == speed) onStart { @body_1 = findBody("sphere") @body_1.static = true @body_1.nocollision = true } onUpdate { up = 50 + oscillator(20) @body_1.setTransformation([0, 0, up]) setVar("servo", oscillator(20)) #Joints Controller: oscillator(20) } 3.6.1 > October 6, 2015 > Fixed the webdialogs. Now font sizing is automatic with webdialog width. The dialog windows is freely scalable ! > Integrated 61 wav sound files in sound folder. > Removed the GamePlay button. > Added Windows detector: SP3xCommonContext.os_windows? Returns (RUBY_PLATFORM =~ /mswin|mingw/i) ? true : false Version 3.6.0 - July 4, 2015 - New style. - Added an option to scale joints: (Menu)Plugins->SketchyPhysics->Edit Joint Scale - Added new GamePlay button. This will hide the "Joint Controller panel" and SketchUp Axes. Reset simulation with ESC button. - Added mouse controller. Only for Windows and can be used only once in Script-box!: MSketchyPhysics3::SP3xBodyContext.#getMouseAxes Returns: [x,y] Array - Added head move function for fps type games. (Used only once!): MSketchyPhysics3::SP3xBodyContext.#setSphereAxes(left-right, up-down) Returns: [x,y] Array - Added Frames Per Second caller. (Used only once!): MSketchyPhysics3::SP3xBodyContext.#getFps Returns: Numeric - Added transition. Array logarithm only; Number logarithm- or linear : MSketchyPhysics3::SP3xBodyContext.#transition(new, current, speed, linear = state) Returns: Numeric - Added body transformation: MSketchyPhysics3::SP3xBodyContext.#setTransformation(new * rotation * scaling) Returns: self.group.transformation = Geom::Transformation - Added FPS getter function: MSketchyPhysics3::SP3xSimulationContext.#fps Accessible from anywhere by writing $curPhysicsSimulation.fps. Returns: Numeric - Added body center point caller: MSketchyPhysics3::SP3xBodyContext.#getCenter(body) Returns: 3D point - Added body origin point caller: MSketchyPhysics3::SP3xBodyContext.#getOrigin(body) Returns: 3D point - Added body axes caller: MSketchyPhysics3::SP3xBodyContext.#getAxes(body) Returns: Array - Added entities caller: MSketchyPhysics3::SP3xBodyContext.#getEntity(number) Returns: Sketchup.active_model.entities[number] - Added layer caller: MSketchyPhysics3::SP3xBodyContext.#getLayer(number) Returns: Sketchup.active_model.layers[number] - Added MSketchyPhysics3::SP3xBodyContext.#visible=(state) Returns: body.visible=true/false - Added MSketchyPhysics3::SP3xBodyContext.#conversion=(transformations) Returns: self.group.transformation - Added MSketchyPhysics3::SP3xBodyContext.#transformation_N(position, x, y, z) Returns: Geom::Transformation.new - Added MSketchyPhysics3::SP3xBodyContext.#transformation_R(rotation in degrees, vector, point) Returns: Geom::Transformation.rotation - Added MSketchyPhysics3::SP3xBodyContext.#transformation_S(x, y, z) Returns: Geom::Transformation.scaling - Added MSketchyPhysics3::SP3xBodyContext.#newPoint(x, y, z) Returns: Geom::Point3d.new - Added MSketchyPhysics3::SP3xBodyContext.#newVector(x, y, z) Returns: Geom::Vector3d.new Version 3.5.6 - January 26, 2015 - Minor adjustment to the custom drag tool. - Improved security for the two SU API adding methods. - Resolved more compatibility issues with some prior SP models. - Removed some unnecessary Ruby API adder methods. Thanks to ThomThom for finding them. - Fixed minor gear joints bug. Thanks to Deskpilot for reporting. Version 3.5.5 - October 25, 2014 - Reverted some changes to default shape to keep compatible with prior versions. As well fixed a bug created in SP3.5.4 Thanks to faust07 for report. Version 3.5.4 - October 22, 2014 - Fixed a bug where flipped bodies didn't generate proper collisions. Thanks to faust07 for report. Version 3.5.3 - October 16, 2014 - Minor fixes and improvements. - onTouch position parameter should be multiplied by the world scale. - Added MSketchyPhysics3::SketchyPhysicsClient.#getLifetime(grp), #getLifeStart(grp), #getLifeEnd(grp), and #getEmitter(grp). Version 3.5.2 - September 24, 2014 - Flipped groups should no longer unflip when simulation starts. - Scaled groups with convex collisions should no longer fall through other bodies. - Added MSketchyPhysics3::SP3xBodyContext.#getGlobalCentreOfMass to get body centre of mass in global space. - Made adjustments to the dialog, error handlers, and the drag tool. Version 3.5.1 - September 13, 2014 - Converted all fixnum forces to float to prevent errors. - Made new copyBody function compatible with prior scripted models, specifically SP3RC1 Artillery by Mr.K. - Stabilized shift flipped bodies technique which was added in SP3.5. - Fixed a typo where centre of mass of convexhull2 and compound2 would remain improper. - Inspector should lookup joints in all shapes. Originally it looked up joints within the default shape only. - Updated homepage link Version 3.5.0 - September 12, 2014 - Fixed tagName exception, a small error that would raise in Sketchy UI from time to time. - Fixed a glitch where Sketchy UI would fail to save if the dialog is closed via the UI button. - Joint limit inputs shall be able to interpret math operations. You can type 100.mm and it will be converted to 3.94 inches automatically or cos(60.degrees) and it will be evaluated to 0.50. - Attributes to the newton body pointer, group scale, and some other unused attributes shall be removed when simulation resets. Storing them is not essential. - Component/group axis are no longer modified. This change improves start and reset simulation performance. - Rewrote pick and drag tool, which relies its calculations on body centre of mass, not group origin as originally intended. The original drag tool required group axis be shifted to the bounds center (predefined centre of mass). Changing the drag tool was an essential step because first, it no longer required moving entity axis to the body centre of mass, second, changing centre of mass via the setCentreOfMass function doesn't require changing group axis, and third, the new drag tool is quite more flexible than the original one. The new drag tool is adapted from the Newton Dynamics physics utilities. - Added Convexhull2 shape, which includes all sub groups in calculation of convex collision, and maintains true centre of mass. Original convexhull picks geometry one level deep, but does not gather geometry from groups within the group. As well it does not have true centre of mass. Convexhull2 was added to overcome such problems. Joints and all ignored bodies are not included in collision calculation. - Added Compound2 shape, which includes all sub groups in calculation of compound collision, and maintains true centre of mass. Joints and all ignored bodies are not included in collision calculation. Enable show collision option to see the differences between Default and Compound2 shape. - Added Staticmesh2 shape, which includes all faces of sub groups in calculation of tree collision. Joints and all ignored groups are not processed in part of the collision. Original staticmesh gathers faces one level deep within the group, but does not search through groups inside the main group; that's why staticmesh2 was added. - MSketchyPhysics3::SP3xBodyContext.#getCentreOfMass should extract world scale. - Added MSketchyPhysics3::SP3xBodyContext.#setCentreOfMass(centre) - Added MSketchyPhysics3::SP3xBodyContext.#getVolume - returns body volume in cubic inches. - Added MSketchyPhysics3::SP3xBodyContext.#getDensity - returns mass ratio per cubic inch. - Added MSketchyPhysics3::SP3xBodyContext.#getMatrix - returns body transformation matrix. - Added MSketchyPhysics3::SP3xBodyContext.#setMatrix(matrix) - similar to teleport. - Added MSketchyPhysics3::SP3xBodyContext.#continuousCollisionEnabled? - Added MSketchyPhysics3::SP3xBodyContext.#continuousCollisionEnabled=(v) Setting state to true will prevent body from passing other bodies at high speeds, although this could alter performance at the same time. - Added MSketchyPhysics3::SP3xBodyContext.#solid? to determine whether body is collidable. - Added MSketchyPhysics3::SP3xBodyContext.#collidable? which is same as #.solid? - Added MSketchyPhysics3::SP3xBodyContext.#collidable= which is same as #.solid= - Added MSketchyPhysics3::SP3xBodyContext.#magnetic? to determine whether body is magnetic. - Added MSketchyPhysics3::SketchyPhysicsClient.#pickAndDragEnabled=(v), which is an equivalent to pick_drag_enabled=(v). - Added MSketchyPhysics3::SketchyPhysicsClient.#pickAndDragEnabled?, which is an equivalent to pick_drag_enabled? - Fixed MSketchyPhysics3::SP3xCommonContext.#joy and .#joybutton methods. Now, they should work if called from the scripted field too. - Added MSketchyPhysics3::SP3xCommonContext.#stopSound(channel) - Added MSketchyPhysics3::SP3xCommonContext.#stopAllSounds - Added MSketchyPhysics3::SP3xCommonContext.#simulation which returns $curPhysicsSimulation. Originally it was accessible from the scripted field only. Now, its accessible from the controller fields too. - Added MSketchyPhysics3::SP3xSimulationContext.#getFrameRate, which is an equivalent to #frame_rate method. - Added MSketchyPhysics3::SP3xSimulationContext.#getWorldScale - Added MSketchyPhysics3::SP3xSimulationContext.#getGravity, which is an equivalent to #gravity method. - Added MSketchyPhysics3::SP3xSimulationContext.#setGravity(acceleration). - Fixed a bug where staticmesh inside a group would force simulation to crash. A staticmesh or compound within the group becomes default shape. - Stabilized compatibility for SP3RC1, SP3.1, and SP3.2 scripted models. Now, all advanced scripted models created in previous SP versions shall work with SP3.5. - Added continuous collision checkbox option to the emitter. Enabling this will prevent emitted bodies from passing other bodies at high speeds. Now, bullets will collide if CC is enabled. - Added units of measurement to the joint limits. Thanks to Platinius for request. - Added scripting reference links to UI for easy reference destination. - Fixed a glitch where objects would use 0.2 as default density, not the assigned default density. Version 3.4.1 - September 02, 2014 - Reverted some changes in SP Replay for compatibility with LightUp and Skindigo. - Added '(Menu) Plugins > Sketchy Physics > Erase All Attributes' option. Version 3.4.0 - September 01, 2014 - Compatibility for Mac OS X. Thanks to Kevin (willeykj) for helping out. - Fixed MIDI on new Mac OS X platforms https://code.google.com/p/sketchyphysics/issues/detail?id=90 Thanks to Kevin (willeykj) for providing the fix in the post. - Renamed folder back to SketchyPhysics3 for compatibility with prior scripted models. You may want to remove original SketchyPhysics folder from the Plugins folder. - Changed the way errors are handled. All script errors will force simulation to reset, displaying a message box with an error. Meanwhile, all controller errors will be displayed in the Ruby Console, but keep simulation running without breaking next tasks. - Reverted some changes to remain compatible with the advanced scripted models. I thought to add compatibility files at first, but did not want to make it a hard task for scripters to migrate their advanced code to 3.4. I also added compatibility for SP3x and SP3RC1. Now all scripted models from various SP versions shall work in 3.4. Although some advanced scripted models created by me will not work because they modify way too much. Keep in mind, a lot of scripted models will operate in SU 2013 and below only. SU 2013 and lower use Ruby 1.8.x, while SU 2014 uses Ruby 2.0.0. There were Ruby implementation changes since 1.8.x. These include, prohibited use of spaces between method name and the parentheses, prohibited use of colons (:) in case-when statement, and replaced Hash.#index with Hash.#key. As well, all models that use LazyScript will operate in SU 2013 and below only. Some LazyScript functions use Ruby DL, which is only available in Ruby 1.8.x categories. SP 3.4, on SU 2014, uses Fiddle because DL is deprecated in Ruby 2.0.0. - Added Sketchup::Group.#definition and Sketchup::ComponentInstance.#entities for compatibility with prior scripted models. These are the only two methods SP adds to Sketchup API. These methods shouldn't break any plugins, but they may confuse a plugin developer. - Included Math into Object for compatibility with prior models. Such change shouldn't affect any plugins, but it may confuse the plugin developer. - Fixed minor controller inconsistencies and errors created while rewriting the code in SP 3.3. Thanks to my brother Stas for finding the bug at a very last moment before the upload. - Fixed compound transformation shift. Thanks to Kris Yokoo and Joseph Shawa for report. This is also a bug I introduced in SP 3.3. - Fixed export animation in SU2014. Thanks to Werner_Hundt for report. - Added start/commit operation to Sketchy Replay for better performance. - Added export camera recording to Sketchy Replay. Thanks to faust07 for report and Mr.K for writing the original script. - Changed abort_operation back to commit_operation as abort_operation is unsafe and breaks compatibility. - Organized icons - Made SketchyPhysicsClient and SketchyReplay compatible with the Twilight Render. - Added export animation to Kerkythea. You must have have Kerkythea plugin installed in order for that feature to work. Thanks to tallbridgeguy for request. - Migrated from FFI to Fiddle. This reduces folder size, and allows SP to operate on Mac OS X. - Added MSketchyPhysics3::SP3xBodyContext.#static? - Added MSketchyPhysics3::SP3xBodyContext.#static=(state) - Added MSketchyPhysics3::SP3xBodyContext.#frozen? - Added MSketchyPhysics3::SP3xBodyContext.#frozen=(state) - Added MSketchyPhysics3::SP3xBodyContext.#getMass - Added MSketchyPhysics3::SP3xBodyContext.#setMass(mass) - Added MSketchyPhysics3::SP3xBodyContext.#recalculateMass(density) - Added MSketchyPhysics3::SP3xBodyContext.#recalculateMassProperties - This method assigns proper centre of mass to the body. SP defines entity bounds center as centre of mass, which is incorrect in various cases. This function calculates centre of mass using Newton function, which presumes the correct centre of mass and moments of inertia. - Added MSketchyPhysics3::SP3xBodyContext.#getCentreOfMass - Returns centre of mass coordinates relative to the body transformation. - Added MSketchyPhysics3::SP3xBodyContext.#this - returns self. - Added MSketchyPhysics3::ControllerContext.#lookAt(nil) to destroy the lookAt constraint. - Added lookAt method to the MSketchyPhysics3::SP3xBodyContext. - Added MSketchyPhysics3.getNewtonVersion. - Improved MSketchyPhysics3::SP3xBodyContext.#breakit method. Plane size shall not be fixed, but shall rely on the group bounds diagonal. - Improved MSketchyPhysics3::SP3xBodyContext.split method. Split body becomes static. Ideally it should be destroyed, but keeping it ensures compatibility. - onUntouch event shall be called even if onTouch/onTouching is not included. - Improved SP Sound UI. Fixed 'Play Sound' button and added 'Stop Sound' button. Only WAVE sound format is supported. OGG doesn't seem to work. Version 3.3.0 - July 20, 2014 - Compatible in SU2013, and SU2014. - Replaced all Sketchup API modifying and adding methods, including Sketchup::Group.#copy. Warning, this change prevents many scripted models from working, especially those that rely on object entities. ComponentInstance doesn't have a .entities method, but its definition does. You will have to check before getting entities: if ent.is_a?(Sketchup::ComponentInstnace) ents = ent.definition.entities elsif ent.is_a?(Sketchup::Group) ents = ent.entities end Or use an available function: ents = MSketchyPhysics3.get_entities(ent). - Minimized the use of global variables. Warning, this change prevents many scripted models from working, especially LazyScript which depends on $sketchyphysics_script_version variable. Use MSketchyPhysics::VERSION instead. Many more global variables were removed as well; however, $curPhysicsSimulation and $sketchyPhysicsToolInstance were not removed, as they are quite handy. - Improved script error handlers. Simulation will reset properly if an error occurs. All detected errors, except those in joint controllers, will force simulation to abort. Due to that change many models that were uploaded with script errors will no longer work until they r' fixed. - Fixed minor inspector dialog errors. - Dialog clears when selection clears. - Script can handle all sorts of escape characters. - No longer throws two error messages. - You're no longer required to click on the element to save the written script. - Rewrote most Ruby files, just to improve the way code looks and fixed some minor bugs and inconsistencies. Note: This change could raise more errors as I didn't pay much attention to what I did there. Need testers! - Used Ruby DL to export functions for Ruby 1.8.x, used FFI to export functions for Ruby 2.0.0. - Added setSoundPosition2, which properly distributes 3d sound to the left and right speakers, and controls volume depending by the specified hearing range. - Added drawPoints to simulation context, which allows you to draw points with style. - Added $sketchyPhysicsSimulationTool.cursorPos method - get cursor position relative to view origin. - Added more virtual key codes, 0-9 keys, semicolons, brackets, etc. - Improved SP3xCommonContext.#key method. You may pass key values to determine whether the specified key is down. This was added as a backup technique if the desired key name is missing, you can pass key constant value to get its up/down state. - Emit bodies with original density. Previously copied bodies did not have same density as the original bodies did. This is fixed now. - Temporarily removed check for update as it would recommend downloading SP3.2. Use SketchyUcation PluginStore instead. - Added simulation.drawExt method, which basically behaves the same as simulation.draw, but with more available types. Including, the 'line' type yields GL_LINES rather than GL_LINE_STRIP like in the simulation.draw method. The simulation.draw method was not replaced just to remain compatible. - View OpenGL drawn geometry is now included in the bounding box. - Added ondraw { |view, bb| } - bb is the Geom::BoundingBox. Use it to add 3d points to the bounding box, so they don't get clipped. First, add points and then draw. - Used abort_operation rather than commit_operation to reset simulation. This undoes most model changes made during simulation. - Created joints will no longer add 'jointBlue' material... - Removed MSketchyPhysics3::SketchyPhysicsClient.resetSimulation method. Use MSketchyPhysics3::SketchyPhysicsClient.physicsStart to start. Use MSketchyPhysics3::SketchyPhysicsClient.physicsReset to reset. Use MSketchyPhysics3::SketchyPhysicsClient.physicsTogglePlay to play or pause. Use MSketchyPhysics3::SketchyPhysicsClient.paused? to determine whether simulation is paused. Use MSketchyPhysics3::SketchyPhysicsClient.active? to determine whether simulation has started. - Entity axis are no longer modified. They are modified, but they are set back when simulation resets. - Clears reference to all big variables at end, so garbage collection cleans stuff up. - Improved drag tool. Objects won't go to far, and lift object works even if camera is looking from the top. - Fix the glitch in joint connection tool where cursors didn't update. - Added cursor access method. $sketchyPhysicsToolInstance.getCursor - returns cursor id. $sketchyPhysicsToolInstance.setCursor(id) - id: can be String, Symbol, or Fixnum. Available names are select_plus, select_plus_minus, hand, and target. For instance, set target cursor when creating FPS games: onstart { $sketchyPhysicsToolInstance.setCursor(:target) } - Added toggle pick and drag tool. When creating FPS games you might want to disable the drag tool, so player can't pick bodies. Use $sketchyPhysicsToolInstance.pick_drag_enabled = state (true or false) Use $sketchyPhysicsToolInstance.pick_drag_enabled? to determine whether the drag tool is enabled. Example: onstart { $sketchyPhysicsToolInstance.pick_drag_enabled = false } - Added aliased event names: onstart : onStart onend : onEnd ontick : onTick : onupdate :onUpdate onpreframe : onPreFrame : onpreupdate :onPreUpdate onpostframe : onPostFrame : onpostupdate :onPostUpdate ontouch : onTouch ontouching : onTouching onuntouch : onUntouch ondraw : onDraw onclick : onClick onunclick : onUnclick ondoubleclick : onDoubleClick ondrag : onDrag - Improved record tool: * Objects will move to their original positions when you press the rewind button, regardless of when you started the recording. * You may toggle recording any-time during simulation. * Missing frames will no longer force the object to hide (move! 0). - onDrag is called once a frame now (if the mouse is moved). - Added onDoubleClick implementation. - Added sp_tool which returns MSketchyPhysics3::SketchyPhysicsClient. - Added sp_tool_instance which returns $sketchyPhysicsToolInstance. |
[#/sketchup/plugins/sketchyphysics” ]