12 posts • Page 1 of 1
What little time I have had for SP lately I spent working on a model. It is inspired by this video:
In order to make it work I had to add a few new features to SP (hey its good to be the author).
First I tried using the new sound embedding to make a set of instruments. I soon realized that to make it work it would take a huge amount of .wav samples (one for each note or drum) and that made the file way too big. So I started to look at Midi.
Turns out Win and Mac both support Midi instrument playback and there are huge number of built in instruments samples plus a nice collection of sound effects.
And because the midi notes are on/off and velocity based it suites itself well to SP physics ontouch/onuntouch events.
After I got it working (with a lot of help from Kevin) I did the attached drum set.
It works. But depending on your setup it probably sounds like the drummer is on speed or ludes and drunk in the bargain. The beat of the drums is totally dependent on the frame rate.
After some thought I decided to try a piano next. After some work I managed to fix most of the timing problems. Check out the piano example. I its really cool! And I think I know how to make the percussion instruments work now.
It would be easy to fake it and play a note then move a finger. But its done right and the note plays only when a finger touches a key. That involves calculating the delay in the servo and adjusting the score accordingly.
If this version and the demos work for everyone I will clean up the interfaces and a proper 3.2 release.
http://sketchyphysics.googlecode.com/fi ... 2-Nov1.exe
Here are the changes since the last version:
Changes in version 3.2
- Added midi note support.
- New user events system. Script commands "on" and "signal"
- Wacovs hud code. script commands draw,draw2d,draw3d and view accessor.
- joint.controllerValue now works with motors and gyros
- New script command setFrameRate overrides physics settings framerate.
- Added script command setSoundPosition(sound,position,volume=5.0) Allows 3d audio when called once per tick.
- Fixed a Mac SDL sound crash (thanks Kevin!)
- Fixed sounds not stopping at end of simulation
- Fixed bug where solids would drop into floor first time you run.
- Bug fix. Scripted flag wasnt being observed at runtime.
Removed a lot of debug spam. Added a little.
Please, register (free) to access all the attachments on the forums.
I installed the SP3.2, it works really good.
And the "Piano-JukeBox7" is awesome, its not slow in frame-rate.
I had seen the Animusic Movies before and think thats great done.
The piano works great, and I add a little stuff to it, when it press the key you the key "lights up" red.
Cause when I see at the cool simulation its a little bit hard to see which key thats playing.
It's done with a simple on/un-touch that you use, and works great.
Fun that you fixed the bug
Fixed bug where solids would drop into floor first time you run. .
It was a bit boring, but now it works great that to.
Windows 7 U - Sketchup 8 - SketchyPhysics 3.2-Dec2 - from Sweden
Chris (or anybody else that might have a clue!), what do you think of some sort of way to snapshot the current state of the simulation - objects, camera, etc - much like you can do with scenes, except aware of where SP thinks everything is at the moment?
I don't mind poking around in the code, but if you've got a suggestion that might move me along in the right direction while reducing code poking, I'd be grateful.
The goal is to be able to make smoother transitions between animation sections. Usually my objects need to undergo pretty complex movements that I have a hard time setting up in a single scene and one set of hinges/rules. So I break the movements into more reasonably code-able sections and then stitch them together later.
The awkward part, then, is remembering where we were at the very end of the previous segment.
I'm not sure if this is the right place to ask but here goes. Is it possible to open text files from within a simulation. All those midi hashes in the piano would seem to be screaming for such an input and the animations I am trying (with limited) success in regular ol' ruby script are using a list of coordinates read from a data file. Any insights as to if/when this might be possible would be great.
I am not exactly what you are asking for. Did you know that at any point in the simulation you can pause it then save the model. That will capture that frame in time. Is that what you need?
I am sorry, Chris, I did not see this answer. Not sure why!
Anyhow, yes, that is precisely what I need. I did not know I could do that. Perfect. Thanks so much.
I downloaded all the important models for SP 3.1 and added them to the 3D warehouse some time ago.
Curves Test and Curves Controllers are very good examples of path following.
Fantastic! Thanks so much. I have downloaded several and started to play.
Question on CurvesTest3.skp - how did the curves come about initially, and how did they get names?
Meaning: I can see the scripted setting on, say, the block. It's doing a teleport to the beginning of a curve ( teleport(evalCurveAbs("blockpath",frame))) with name "blockpath" and then using that same curve name to move along it. So far so good. If I click on the curve in SU (I am using 8.0.3117 free) I see in the Entity Info that this is a curve on Layer0 with 35 segments and a length of 1282.3907, not hidden, and it does cast shadows. But I do not see anything identifying its name.
I know you can give groups and components names. But this is neither of those. So how did it get a name or, more significantly for me, I guess, how can I give any curve a name?
As for them coming about, I suppose that you could either use the freehand tool, or draw an arc or circle or polygon, but what else? What if I wanted to draw a very complex shape with, say, a combination of several arcs, line segments, etc? Is that something that could end up being combined into a single curve that I could then give a name, and that would then be followable by SP?
Ya SU is a little rusty on curves so the setup is a little different.
SU itself only creates curves with the circle and arc tools, and the add_curve function in Ruby, which is all very limiting.
So the best thing to do is getting the Weld plugin for SU, or any of the various spline plugins that let you make curves with alot more precision and ease.
When you have a curve, right-click it and go to SketchyPhysics -> Make physics curve, this will give you a prompt for a new name, write it and hit OK, and you got your curve set up.
Now a couple of extra tips:
- closed curves don't have a predefined start point (so every time you open your model the starting point will be different, sometimes it even switches between simulations)
- curve orientation sometimes changes (it may move in one direction once created, and then switch after opening the model again, I'm sure there is a reason for this, but I haven't yet found it)
12 posts • Page 1 of 1