SketchyPhysics 3.5.6 (26 January 2015)
-
SketchyPhysics is a real-time physics simulation plugin for SketchUp created by Chris Phillips.
See extended versions maintained by PituPhysics: https://sketchucation.com/forums/viewtopic.php?f=61&t=62453
SP 3.5, the unofficial release, comes with many bug fixes, API improvements & enchantments, support for SU6 or later, and compatibility for Mac OS X 10.5+ & MSFT Windows. For now, it's only compatible with SketchUp 32bit.
SP 3.5 is compatible with most if not all SketchyPhysics models. Even Some SP 3RC1 models incompatible with SP 3.2 are compatible with SP 3.5. There is one thing user must keep in mind. Most scripted models from 3D Warehouse don't work in SketchUp 2014; however, they do work in SketchUp 2013 and below. That is because SketchUp 2014 uses Ruby 2.0.0; meanwhile, prior SketchUp versions use Ruby 1.8.x. There were Ruby syntax changes since 1.8.x, which all scripts must be updated for compatibility with SketchUp 2014. See Updating Scripts for SU2014 Compatibility for instructions.
Not many features were added since SP 3.2. However, there were descent changes and improvements to SketchyPhysics API, which minimize potentials for crash and errors. One major optimization in SP 3.5 is avoiding to modify group/component axes. In SP 3.2, whenever simulation would start, SP code would iterate through all groups/components and shift their axes to a different location, which is the group's bounds center. There are two cons of doing this. One, it may disturb the user that their model is modified. Two, it takes time to shift axes. It would take forever for SP to start if there were thousand of groups awaiting simulation. I'm not sure why this axes shift was added in the first place, but I think it was made to keep the original drag tool working properly -- if group origin is not in its predefined centre of mass (which is groups bounds center) the drag tool works improperly. Despite such complications, SP 3.5 does not modify group/component axes and uses a custom drag tool to prevent any improper behavior. Along with that, start simulation performance has been improved significantly. Another optimization is removing any unused attributes created by SP, which keeps the model clean, and reduces its size. Last, but not least, SP 3.5 handles script errors like a charm. Any error in simulation is either printed in console or forces simulation to reset. In SP 3.2, such operations did not turn out successfully.
Here are some more improvements and changes since SP 3.3:
- Scaled groups/components have proper collisions.
- Flipped groups/components no longer unflip when simulation starts.
And here are some features since SP 3.3:
- Export animation to Kerkythea.
- Record simulation camera movements.
- Convexhull2 shape. Unlike convexhull, convexhull2 include's all sub-groups and sub-components (except joints and ignored entities) in collision calculation. As well, it maintains real centre of mass, unlike convexhull which uses group's bounds center as centre of mass.
- Compound2 shape. Every sub group and component in compound2 shape with unassigned collision is assigned a convexhull2 collision; meanwhile, all sub groups and components in default shape are by default assigned a box collision. Unlike default shape, compound2 maintains true centre of mass.
- You can change body mass, assign transformation, toggle it static, and due more things with the extended scripting API. See SP Script Overview for a detailed documentation.
Improved dialog! No more 'webdialog dirty' errors, no more have to click on the input to save script, a new feature which allows you to preset min/max angle or length units.
Reference/How To
- SP Script Overview
- Updating Scripts for SU2014 Compatibility
- Saving with Simulation Scene
- Exporting Recorded Animation
- SketchyPhysics and Kerkythea
- SketchyPhysics and Twilight Render
- Use MakeAVI or similar software to combine exported animation images into an AVI.
Download
Delete all original versions before downloading the new one!
Available at PluginStore
Alternatively can be downloaded from Google Drive
Note: For now, SketchyPhysics is only compatible with SketchUp 32bit. It will not work with SU2015 64bit or SU2016 64bit, however, it will work with SU2015 32bit and SU2016 32bit. The most recommended version is SU2013 because compared to newer versions which use Ruby 2.0, SU2013 uses Ruby 1.8, allowing most non-updated scripted models at 3DWarehouse to work properly. However, if playing non-updated scripted models is not an aim, SU2014 might be the most suitable. SU2015 32bit and SU2016 32bit are not recommended because at some point entity ids are regenerated by SketchUp interface causing all joint connections to be discarded.- SketchUp versions post 2013 can be obtained at SketchUp Website.
- SketchUp versions prior 2013 can be downloaded at FileHippo.
Installation Instructions
Before you download, delete original SketchyPhysics version! You don't need to download any other version to get this version working.
There are several ways to install the plugin.
[list:2wnapxjs]
[*:2wnapxjs]- Download SketchyPhysics_3.x.x.rbz
- If you downloaded the .zip format, simply rename the extension to .rbz format.
- Open SketchUp and navigate to (Menu) Window > Preferences.
- In the preferences window navigate to Extensions tab and select
Install Extension...
button - From there, find your downloaded compressed file, and select
Open
button, which will install the extension.[/2wnapxjs]
[:2wnapxjs]
- Download SketchyPhysics_3.x.x.zip. If you downloaded .rbz format, then simply rename it to .zip format.
- And extract SketchyPhysics to the plugins folder.
Plugins folder location:
- For SU8 and below, *C:\Program Files (x86)\Google\Google SketchUp [n]\Plugins*
- For SU2013, *C:\Program Files (x86)\SketchUp\SketchUp 2013\Plugins*
- For SU2014, *C:\Users\YOUR_NAME\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins*
- It should look like this once you extracted:
*..\Plugins*
SketchyPhysics3
SketchyPhysics.rb
[/list2wnapxjs]- Use SketchUcation PluginStore. It is the easiest way to install extensions.
Change Log
- 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 and geometry 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 [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#collidable?[/ruby:2wnapxjs] which is same as #.solid?
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#collidable=[/ruby:2wnapxjs] which is same as #.solid=
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#magnetic?[/ruby:2wnapxjs] to determine whether body is magnetic.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SketchyPhysicsClient.#pickAndDragEnabled=(v)[/ruby:2wnapxjs], which is an equivalent to pick_drag_enabled=(v).
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SketchyPhysicsClient.#pickAndDragEnabled?[/ruby:2wnapxjs], 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 [ruby:2wnapxjs]MSketchyPhysics3::SP3xCommonContext.#stopSound(channel)[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xCommonContext.#stopAllSounds[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xCommonContext.#simulation[/ruby:2wnapxjs] which returns $curPhysicsSimulation. Originally it was accessible from the scripted field only. Now, its accessible from the controller fields too.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xSimulationContext.#getFrameRate[/ruby:2wnapxjs], which is an equivalent to #frame_rate method.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xSimulationContext.#getWorldScale[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xSimulationContext.#getGravity[/ruby:2wnapxjs], which is an equivalent to #gravity method.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xSimulationContext.#setGravity(acceleration)[/ruby:2wnapxjs].
-
Fixed a bug where staticmesh inside a group would force simulation to crash. A staticmesh or compound within the group becomes default shape now.
-
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. Try out some advanced models at 3d warehouse if you don't believe Keep in mind, most scripted models will work in SU2013 and below because they use outdated Ruby implementation techniques; however, SP Midi Piano works just well on SU2014 because it's script is written quite well, i.e future proof for Ruby 2.0.0.
-
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
[list:2wnapxjs]
[*:2wnapxjs]Reverted SP Replay changes for compatibility with LightUp and Skindigo. Keep in mind SkIndigo 3.6.28.3 has a little bug. Please follow these steps to fix it: -
Open Plugins/skindigo/AnimationExport.rb.
-
Scroll down to line 369 and replace [ruby:2wnapxjs]mb.build_active_mesh(ents)[/ruby:2wnapxjs] with [ruby:2wnapxjs]mb.build_active_mesh(ents, {})[/ruby:2wnapxjs]
-
Save file and you're good to go.[/list2wnapxjs]
-
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. 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 (Anton Synytsia) 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 [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#static?[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#static=(state)[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#frozen?[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#frozen=(state)[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#getMass[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#setMass(mass)[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#recalculateMass(density)[/ruby:2wnapxjs]
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#recalculateMassProperties[/ruby:2wnapxjs] - 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 [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#getCentreOfMass[/ruby:2wnapxjs] - Returns centre of mass coordinates relative to the body transformation.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#this[/ruby:2wnapxjs] - returns self.
-
Added [ruby:2wnapxjs]MSketchyPhysics3::ControllerContext.#lookAt(nil)[/ruby:2wnapxjs] to destroy the lookAt constraint.
-
Added [ruby:2wnapxjs]lookAt[/ruby:2wnapxjs] method to the [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext[/ruby:2wnapxjs].
-
Added [ruby:2wnapxjs]MSketchyPhysics3.getNewtonVersion[/ruby:2wnapxjs].
-
Improved [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.#breakit[/ruby:2wnapxjs] method. Plane size shall not be fixed, but shall rely on the group bounds diagonal.
-
Improved [ruby:2wnapxjs]MSketchyPhysics3::SP3xBodyContext.split[/ruby:2wnapxjs] 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 -
http://sketchucation.com/forums/viewtopic.php?f=61%26amp;t=58567
To Do/Wish List
- Add more virtual keys to Mac OS X.
- ~ Get rid of global getKeyState in input.rb.
- Work on sp_midi.rb
- Rewrite all dialogs. Use jquery. Have major web content in html, css, and js files. Update dialog style.
- Improve joint API. Make each joint have its own joint context. Connect/disconnect joint simply by creating/destroying the constraint.
- Avoid making components unique as this task affects modeller's work flow. Commenting out all the .make_unique is not enough, the way collision is generated needs to changed too. Meantime, use CTRL-Z after simulation resets to undo most if not all changes done during simulation.
- Capture/Release mouse (For FPS games).
- Add particle effects, and more goodies from the LazyScript.
- Add explosion impact function.
- Add follow curve joint, a piston with a user created curve inside.
- Upgrade to Newton 3.13 as it's way faster than Newton 1.53.
- Upgrade to SLD2 as it supports many different sound types. Consequently change the way sounds are handled. Keep the reference to the sound type, so we could use same list-box for all sound types.
- Investigate copied joints. Investigate why each joints needs a unique name. Investigate why joints inside components are ignored.
- Add compound3 shape, where each triplet of face is an extruded convex hull.
-
All I'm left to do is create a small documentation listing SP methods and functions.
-
I am extremely grateful for your efforts and in awe of your abilities! For sure a donation is on its way!
-
Thanks Joseph
-
Thank you, Anton - you are the greatest! Sketchy greetings from Cologne
-
Thanks Werner
-
It seems that exporting Sketchy Replay Animation via Skindigo (Indigo rendering plugin) does not work with the current version of SketchyPhysics. This error message keeps popping up.
-
This message pops up because you didn't save animation or doing it wrong.
To export replay animation, you must follow these steps:- Enable recording.
- Press play simulation.
- Run simulation for desired time, and press reset. It will ask you to save animation, press YES.
- Then, you may export animation...
Oh wait this error pops up from the other plugin... Maybe I changed storage locations. I will see what I did there.
Edit: I see what I did there. Storage locations are same, but storage types are different. I changed them from array to hash. I will upload a fix tomorrow.
-
I never knew other plugins use SketchyReplay and thought making changes will not break anything, but gosh I was wrong. This is the same issue with Werners post. The fix is easy. I will upload it tomorrow.
-
Have you some info with the use of SketchyPhysics and LightUP ?
Seems that works with the previous versions of SketchyPhysics but not for this one ?
Maybe Adam will confirm or not this
-
Anton you are stupendous!
-
Always funny for makes some random landscape of elements but...
How export the resultant position of the animation ? The "Pause" position !
In the past "Save as" was sufficient!
Now "Save as" save the "Start position" !Not practical for make cool image!
By Pierreaudoin -
@unknownuser said:
Always funny for makes some random landscape of elements but...
How export the resultant position of the animation ? The "Pause" position !
In the past "Save as" was sufficient!
Now "Save as" save the "Start position" !Not practical for make cool image!
By Pierreaudoinugh what?
If you don't want to save camera you can simply set 'Animate Camera' to 'No' (when exporting animation).
-
@unknownuser said:
Always funny for makes some random landscape of elements but...
How export the resultant position of the animation ? The "Pause" position !
In the past "Save as" was sufficient!
Now "Save as" save the "Start position" !Not practical for make cool image!
Maybe you are searching for this answer?
http://sketchucation.com/forums/viewtopic.php?f=61&t=58901 -
@unknownuser said:
1 Enable recording
2 Start simulation
3 Reset simulation at desired time. It will ask you to save animation. Press YES.
4 Then use the replay tool to get yourself to the desired frame.
After you do so, press the replay button once again to pause and the objects will be left in their new positions.must add 4 : first rewind with the replay tool button!
Yes thx that is that!
At this end I save as V6 for example for using plugins not adapted at the 2014! -
It's ok for LightUp during the "Sketchy Replay" animation !
Not during the Toggle Play "Sketchy Physics" but no problem as the "Replay" works fine! -
Great! Lets wait for a response from Werner, and I'll make it an official release if everything goes well.
-
BTW, thanks for testing Pilou, you rock!
-
Thanks for your swift reply, Anton. Unfortunately, the error message still pops up.
-
Okay, I downloaded Skindigo, and can reproduce the effect. I looked into source and found some inconsistency. I will upload a fix in few minutes.
Advertisement