SketchUcation Plugin Store

 

 

SketchyPhysics 3x June 27 version.

Moderator: CPhillips

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Tue Jun 30, 2009 5:37 pm

It does not work for me :(
Please, register (free) to access all the attachments on the forums.
"Giving up is way harder than trying"
JaViXP's Rendering
JaViXP
 
Posts: 168
Joined: Fri Mar 20, 2009 3:56 pm
Location: Spain
Name: Javier

Re: SketchyPhysics 3x June 27 version.

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

That's wierd, but it should be fixed now.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby phy » Tue Jun 30, 2009 6:03 pm

Awesome :sketchstatic: :ecstatic:
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Tue Jun 30, 2009 11:26 pm

Thanks it worked now. I have to agree with Phy, AWESOME!! :sketchstatic:
"Giving up is way harder than trying"
JaViXP's Rendering
JaViXP
 
Posts: 168
Joined: Fri Mar 20, 2009 3:56 pm
Location: Spain
Name: Javier

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Wed Jul 01, 2009 6:45 am

Here is a script that makes a simple to use auto connecting joint. In the first frame. The "pin" object automatically connects to any "door"'s it is touching with a hinge and anything else with a fixed joint. What makes it really useful is it copyable. :)

Note I made the "pin" object very dense and no collide. It didn't work very well otherwise.
Please, register (free) to access all the attachments on the forums.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Thu Jul 02, 2009 8:51 am

Thanks for the tips Chris. Here's some movable, breakable objects (Kinda laggy, but fun :D )
Please, register (free) to access all the attachments on the forums.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Thu Jul 02, 2009 10:31 am

Well done I like it! :thumb:

So, Chris, any new features we missed? :)
"Giving up is way harder than trying"
JaViXP's Rendering
JaViXP
 
Posts: 168
Joined: Fri Mar 20, 2009 3:56 pm
Location: Spain
Name: Javier

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Thu Jul 02, 2009 1:55 pm

Took quite a while to code this right, and I can't get the faces to smooth, but here it is! Seamless cloth!!

:berserk: :sketchstatic:
Please, register (free) to access all the attachments on the forums.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby phy » Thu Jul 02, 2009 2:56 pm

Um, CPillips how do you use the breakit command or is it a command. I don't mean the split command by the way. Wacov that's fantastic. :thumb:
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Thu Jul 02, 2009 6:11 pm

I'm on a roll...

Turns out you CAN reset the simulation from within the script. Use this little chunk of code:

Code: Select all
@@bPause=true
SketchyPhysicsClient::physicsReset()
MSketchyPhysics3::closeControlPanel()
freeDirectInput()


In the scripted field.

I found this near the bottom of SketchyPhysicsTool.rb, it seems to work totally normally for me, but if there's a problem, there's not much I can do about it :)
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Thu Jul 02, 2009 11:09 pm

That sounds cool! I can't try this though, it displays an error :(

By the way, is there a way to stop the simulation and save it as the model? I mean, you are running the simulation with a breakable box, the box is broken, can you copy the model and paste into other model? (Sorry, my English is hard to understand :oops: )
"Giving up is way harder than trying"
JaViXP's Rendering
JaViXP
 
Posts: 168
Joined: Fri Mar 20, 2009 3:56 pm
Location: Spain
Name: Javier

Re: SketchyPhysics 3x June 27 version.

Postby phy » Fri Jul 03, 2009 1:56 am

It doesn't work for me ether wacov I get this error, taken from the ruby console:
Code: Select all
String doesn't compile: Error in Script:
@@bPause=true

SketchyPhysicsClient::physicsReset()

MSketchyPhysics3::closeControlPanel()

freeDirectInput()
(eval):4:in `initEvents': undefined method `freeDirectInput' for #<MSketchyPhysics3::SP3xBodyContext:0x5dd6378>#<RuntimeError: Error in Script:
@@bPause=true

SketchyPhysicsClient::physicsReset()

MSketchyPhysics3::closeControlPanel()

freeDirectInput()
(eval):4:in `initEvents': undefined method `freeDirectInput' for #<MSketchyPhysics3::SP3xBodyContext:0x5dd6378>>
C:/Program Files/Google/Google SketchUp/Plugins/SketchyPhysics3/ControllerCommands.rb:966:in `initEvents'


and Javi just pause the simulation and save the model.
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Fri Jul 03, 2009 6:32 am

JaViXP wrote:Well done I like it! :thumb:

So, Chris, any new features we missed? :)


Well, there is a lot that is still possible. I haven't seen anyone using teleport yet. Nor getVelocity/setVelocity, getTorque/setTourque or setLinearDamping/setAngularDamping. Any script connected joint can also be disconnected but I dont know a good example for that. Also the scripted code area will take tabs now. That makes it easier to write readable script.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Fri Jul 03, 2009 6:35 am

Wacov wrote:I'm on a roll...

Turns out you CAN reset the simulation from within the script. Use this little chunk of code:

Code: Select all
@@bPause=true
SketchyPhysicsClient::physicsReset()
MSketchyPhysics3::closeControlPanel()
freeDirectInput()


In the scripted field.

I found this near the bottom of SketchyPhysicsTool.rb, it seems to work totally normally for me, but if there's a problem, there's not much I can do about it :)


I am not sure that will work correctly in all cases. Ill try to add something official.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Fri Jul 03, 2009 6:36 am

Wacov wrote:Took quite a while to code this right, and I can't get the faces to smooth, but here it is! Seamless cloth!!

:berserk: :sketchstatic:


Very impressive Wacov!
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Fri Jul 03, 2009 7:03 am

phy wrote:Um, CPillips how do you use the breakit command or is it a command. I don't mean the split command by the way. Wacov that's fantastic. :thumb:


"breakit" is an internal command called by "split". If you want to break an object into more than 2 pieces use this:

Code: Select all
split(self,2)


The "2" means split twice, so you'll get 4 pieces. If you use 3 you will get 16 pieces. 4=256. So dont go nuts. Also remember Sketchup will sometimes crash when you split. The more splits the more likely this is to happen.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Fri Jul 03, 2009 9:20 am

I was going to do an example for split, but it turns out there are some more bugs with it. It wont work in "onstart" for example. use this instead:

Code: Select all
ontick{
   if(frame==1)
      split(self,2)#break into 4 pieces
      ontick{} #disable ontick
   end
}
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby phy » Fri Jul 03, 2009 2:10 pm

Okay thanks.
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Fri Jul 03, 2009 6:10 pm

Got cloth smoothing working, and made it easier to change the scripting (everything's in the floor). Chris, it seems if there's a script error in onend, objects fail to move back to their starting positions... and it can't be undone :? Try sticking jargon in onend, and see for yourself.

Anyway, the updated cloth!
Please, register (free) to access all the attachments on the forums.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Sat Jul 04, 2009 5:18 am

Wacov wrote: Chris, it seems if there's a script error in onend, objects fail to move back to their starting positions... and it can't be undone :? Try sticking jargon in onend, and see for yourself.


Thanks. I fixed it.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Sat Jul 04, 2009 9:19 am

This script is inspired by a new model on 3dwarehouse that ran really smooth... once I turned off shadows and edges.

Paste this into one objects scripted field. It tries to speed up the rendering by disabling shadows and edges during the simulation. Don't worry if you dont understand it. It should be plug and play.


Code: Select all
onstart{
      #save current settings
   ropts=Sketchup.active_model.rendering_options
   sopts=Sketchup.active_model.shadow_info
   @saveROpts=ropts.collect{|k,v|[k,v]}
   @saveSOpts=sopts.collect{|k,v|[k,v]}

      #changes to speed up render
   ropts["EdgeDisplayMode"]=0
   sopts["DisplayShadows"]=false

}
onend{
      #restore render settings.
   @saveROpts.each{|k,v|; Sketchup.active_model.rendering_options[k]=v}
   @saveSOpts.each{|k,v|; Sketchup.active_model.shadow_info[k]=v}
}
Please, register (free) to access all the attachments on the forums.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: SketchyPhysics 3x June 27 version.

Postby JaViXP » Sat Jul 04, 2009 11:53 am

Thanks, that script will be really helpful :thumb:

The bot... Love playing with it! :lol: (I know it's Pecoler's)
By the way, how do you keep the breakable objects already broken? I mean, they are crashed and the simulation didn't start.
"Giving up is way harder than trying"
JaViXP's Rendering
JaViXP
 
Posts: 168
Joined: Fri Mar 20, 2009 3:56 pm
Location: Spain
Name: Javier

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Sun Jul 05, 2009 9:50 am

Uh... Chris... the Joystick commands don't work. I know you said it's all completely new, but that seems like a step backwards :?

You can bridge the gap using global variables, but that's the only way I can find... here's a demo:
Please, register (free) to access all the attachments on the forums.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby phy » Sun Jul 05, 2009 1:58 pm

Um, Wacov is the file supposed to not work?
Okay it works now.
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Mon Jul 06, 2009 4:59 pm

Okay, playing around with vectors (another toe in the API pond). Basically, I'm finding them, then changing their length with joystick inputs. I then use them to control the velocity of an object; in this case, the player in an FPS system; this works pretty sweet, so I'll continue to add features, and see where it takes me!

EDIT: Fixed. Tell me if it's not ;)
Please, register (free) to access all the attachments on the forums.
Last edited by Wacov on Tue Jul 07, 2009 7:49 pm, edited 2 times in total.
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby phy » Mon Jul 06, 2009 6:19 pm

If you cut the script in box1, and run and reset the simulation, and then paste the script back into box1 it will work, I don't know why.
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby phy » Mon Jul 06, 2009 6:31 pm

Sketchyphysics isn't recognizing @@pos2 for some reason. To see for yourself open ruby console hit the play button.
Have A Good Day! ;)
phy
 
Posts: 193
Joined: Sat Nov 15, 2008 4:35 pm

Re: SketchyPhysics 3x June 27 version.

Postby Wacov » Mon Jul 06, 2009 7:11 pm

Thanks Phy! Since you pinpointed it, I found the problem. Seems it was trying to use @@pos2 before it had been created, I just had to add it into onstart and it worked fine!
Wacov
 
Posts: 532
Joined: Wed Sep 24, 2008 8:32 pm
Location: United Kingdom

Re: SketchyPhysics 3x June 27 version.

Postby =Physicsguy= » Wed Jul 08, 2009 11:41 pm

there is an Error. double-clicking wont kick the object.
=Physicsguy=
 
Posts: 332
Joined: Sun Feb 08, 2009 11:51 pm
Location: [10,0,100]
Name: Chris A

Re: SketchyPhysics 3x June 27 version.

Postby CPhillips » Thu Jul 09, 2009 12:38 am

I removed double click = kick because it was seldom used and interfering with the new events.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Keyframe Animation plugin - animate your SketchUp model by adding movement to any object.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012

PreviousNext

Return to SketchyPhysics

Who is online

Users browsing this forum: No registered users and 1 guest