SketchyPhysics 3x June 27 version.

Moderator: CPhillips

SketchyPhysics 3x June 27 version.

Postby CPhillips » Sun Jun 28, 2009 7:16 am

Here is a new Experimental version. Its major feature is the new scripting system so it is primarily for users who are comfortable with script. It is work in progress code and possibly very buggy. You guys let me know.

Because this is not even an alpha I am putting a notice not to upload to 3dwarehouse. But PLEASE post models to these forums. I need to know how you are using the scripts so I can figure out how they will ultimately turn out.

Documentation for this release is going to take a while. I will start with examples in the next post.

Chris

http://sketchyphysics2.googlecode.com/files/SetupSketchyPhysics3x-Jun27.exe
No Mac version yet but there will be soon.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Sun Jun 28, 2009 7:33 am

Here is an example using the new scripting system. It uses the "ontouch" event to create joints between objects. The wheels on the car will connect with a hinge the first thing they touch, in this case the box. The spheres will connect with a ball joint everything they are touching the first frame. That allows them to connect to anything they are touching in the chain.

The nice thing about joints made this way is that you can copy them and they still work as expected.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Sun Jun 28, 2009 7:38 am

This example adjusts linearDamp to make bodies act like they are in space. Also shows that objects can be started in motion.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Sun Jun 28, 2009 7:43 am

Simple breaking objects. The breaking interface is really a work in progress. Sometimes objects breaking can cause Sketchup to crash.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Sun Jun 28, 2009 9:43 am

In the ontouch event, is the speed the speed of the collider at impact... and pos the point of impact?

And thanks for those demos!

Here's my first proper model with it, copyable ragdolls! :berserk: You can't freeze them normally, but you could probably set them to freeze on frame 1, after the joints have connected.
0

Wacov 
 

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Sun Jun 28, 2009 9:59 pm

Chris, how DO you freeze objects in script? Has that been added yet? I've tried frozen=true and frozen(1), but no luck.
0

Wacov 
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Sun Jun 28, 2009 11:31 pm

Since this version is unstable, it would be best if you created a method that stops the simulation, after an amount of time, if something strange happens, or the ismulation gets laggy(breaking feature).
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Mon Jun 29, 2009 1:32 am

Wacov wrote:In the ontouch event, is the speed the speed of the collider at impact... and pos the point of impact?


Yes.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Mon Jun 29, 2009 1:32 am

Wacov wrote:Chris, how DO you freeze objects in script? Has that been added yet? I've tried frozen=true and frozen(1), but no luck.


Doesn't look like I have hooked that up yet.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Mon Jun 29, 2009 1:36 am

=Physicsguy= wrote:Since this version is unstable, it would be best if you created a method that stops the simulation, after an amount of time, if something strange happens, or the ismulation gets laggy(breaking feature).


There isn't a "magic bullet" for that. I need to find all the different ways it can break and then tackle them one at a time.

Post any code you find that breaks the sim and I'll put the right error checking in.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Mon Jun 29, 2009 2:19 am

Pretty nice cloth demo. Once again, totally copyable! I love the scripted joints :berserk:
0

Wacov 
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Mon Jun 29, 2009 2:59 am

Nice! :D
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Mon Jun 29, 2009 4:03 am

That's a nice representation of cloth, Wacov!
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Mon Jun 29, 2009 11:54 am

Thanks guys! One thing I'm finding with the cloth is it tends to collide with itself. That seriously slows stuff down, and it's not really neccessary for a semi-realistic simulation. Can we have object-specific collision detection? So, give the choice to either collide with everything, collide with everything except '...', or collide with nothing but '...'. Keep it pretty intuitive, so using a string finds objects of that name, a var for specific objects, and let us put them into an array if needed.

So, on the cloth, I'd name all the bars the same, and tell them to collide with everything except each other. You might also be able to make a crude fluid flow effect by creating spheres that only collide with the static mesh.
0

Wacov 
 

Re: SketchyPhysics 3x June 27 version.

Postby phy » Mon Jun 29, 2009 2:39 pm

I love the new Script field and script but I was wondering is there any way you can control a scripted joint with a slider or key.
0
Have A Good Day! ;)

phy 
 

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Mon Jun 29, 2009 5:11 pm

Just a little test. Hit Play and see what happens ;)
0
"Giving up is way harder than trying"
JaViXP's Rendering

JaViXP 
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Mon Jun 29, 2009 10:29 pm

YES!! The simulation finally registers in-simulation created objects!
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 12:03 am

Wacov wrote:Thanks guys! One thing I'm finding with the cloth is it tends to collide with itself. That seriously slows stuff down, and it's not really neccessary for a semi-realistic simulation. Can we have object-specific collision detection? So, give the choice to either collide with everything, collide with everything except '...', or collide with nothing but '...'. Keep it pretty intuitive, so using a string finds objects of that name, a var for specific objects, and let us put them into an array if needed.

So, on the cloth, I'd name all the bars the same, and tell them to collide with everything except each other. You might also be able to make a crude fluid flow effect by creating spheres that only collide with the static mesh.


In the physics engine you would need materials to do that. So don't expect it until SPIV.

One thing you could do that might speed things up is to change the connect script to something like this.

Code: Select all
ontouch{|t,s,p|
   connect(t,"ball") if frame==1

    #empty the ontouch event after the first frame.
    #this will ensure that ontouch isnt called again.
   ontouch{} if frame>1
}
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 12:04 am

phy wrote:I love the new Script field and script but I was wondering is there any way you can control a scripted joint with a slider or key.


Not yet. :( But I will do that next.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 12:05 am

JaViXP it will work better if you change the onend to this:

Code: Select all
onend{
   group.erase!
}
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Tue Jun 30, 2009 12:40 am

Will we be able to embed sound files anytime soon?
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Tue Jun 30, 2009 2:21 am

I tried something similar to javixp's line generator, but the groups I generated are not registered.
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 6:40 am

I dont know about the sound. I havent touched that code in a while, but I will see if it still works and let you know.
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Tue Jun 30, 2009 7:12 am

Tracks'n'Treads are much easier. I realy like the new version!
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 9:01 am

Me too! Self connecting joints are a feature I have been trying to achieve since version 1. I HATE the JCT. Its hard to explain, tedious to use and is the reason you cant copy jointed objects. Its THE major reason I started SPIV. So, I am really glad it turns out to be possible in SP3. :berserk:
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Tue Jun 30, 2009 9:39 am

Here is an example of a very simple camera system.

The first example puts the camera eye at the position of the sphere and looking at [0,0,0].

The second example finds the cone in the scene and looks at that. Note you can drag the cone and the camera will follow.

The @simulation.camera.set commands parameters are location of the eye, the target and the "up" direction.

The camera is the same as the camera in the Sketchup API:
http://code.google.com/apis/sketchup/do ... amera.html
0

CPhillips 
PluginStore Author
PluginStore Author
 

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Tue Jun 30, 2009 9:58 am

:berserk: :berserk: Now we can create multi-roll games! :berserk: :berserk:
0

=Physicsguy= 
 

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Tue Jun 30, 2009 10:36 am

CPhillips wrote:JaViXP it will work better if you change the onend to this:

Code: Select all
onend{
   group.erase!
}


Thanks, now it's much better (After a few times playing the animation it becomes kinda slow).

PhysicsGuy, well done I like your boxes creator, but there are too much boxes and it'll make the simulation laggy.
0
"Giving up is way harder than trying"
JaViXP's Rendering

JaViXP 
 

Re: SketchyPhysics 3x June 27 version.

Postby phy » Tue Jun 30, 2009 12:37 pm

MAN! That camera is unbelievablly good. :ecstatic: :ecstatic:
0
Have A Good Day! ;)

phy 
 

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Tue Jun 30, 2009 1:42 pm

It's only half-SP related, but how do you move the ends of a script-created line using script? I've given up trying to replace existing lines on-the-fly, I figure it'd be easier to make them at the beginning of the simulation (or, if possible, before it), then move them every frame. They'd just be there to hold the faces for cloth, and something else I've got planned :D

EDIT: Figured it out! Took alot of searching around, the API documentation isn't all that helpful :lol:
I'm SURE this one's overcomplicated, but it's the only way I could find.

EDIT: Hopefully, I've fixed the problem :)
0
Last edited by Wacov on Tue Jun 30, 2009 5:42 pm, edited 1 time in total.

Wacov 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to SketchyPhysics

Who is online

Users browsing this forum: No registered users and 2 guests

Visit our sponsors: