Here is an alternative solution which is not bad, if you make gentle moves with the arrow keys. You can actually complete the puzzle with this one.
I have an idea for an even more "rigid" solution which I will post in a few days as time allows.
Here is an alternative solution which is not bad, if you make gentle moves with the arrow keys. You can actually complete the puzzle with this one.
I have an idea for an even more "rigid" solution which I will post in a few days as time allows.
Here is my attempt to get the BLOX game to work in a rigid way. When you click on a tile adjacent to the big block it makes a supposedly) temporary joint connection between the block and the tile and rotates the block to the new tile. The only trouble is that the "disconnect joint" method as documented in the Wiki does not work as advertised.
Perhaps Mr K or C.Phillips (or other expert) can tell me how to get the disconnect joint method to work. I have tried everything, but it has beaten me.
Anyway, to see what I have so far, click on any of the green tiles next to the block and it will rotate to that position in a "rigid" way.
P.S. I tried with magnets, but that is not the way to go. It just refuses to behave nicely.
I (think) I have worked out how to implement this game in SketchyPhysics in a "rigid" way. Hopefully I will have time to do it in a couple of days, but if I hit technical problem I will post a Work In Progress anyway. I have a partly working model already. Hopefully Mr K, C.Phillips or some other scripting expert will be able to help out then
To get the direct stiff movement that Mr K mentions, I think you will be better off creating the game as a ruby plugin for regular Sketchup rather than using SketchyPhysics. I am sure it can be done with some effort.
@fransko said:
try this one please
See attached file.
Click right door once to open. Click again to close.
Click left door and hold mouse button down to open, release mouse button to close.
Is that the sort of thing you are after?
@mptak said:
Bjorn...I am in complete agreement however offer this contrary view to all of you multilingual Scandinavians and Europeans. ...
Well, I am of the view that the whole world should only be allowed to speak English and use only Metric units. It would save a lot of translation resources and confusion. That is just my radical (biased) view.
I have attached an updated file in which I have tried to get the units for distance, velocity and acceleration to work in a consistent way. It also reports the time and location when the speed of the falling ball doubles, if it starts with an initial horizontal velocity of 3.2 m/s.
I too have SU8 with SP3.2 on Windows 7, but don't have the exact problem you describe even with older models from Sketchup warehouse. What I do get, is that when I download a warehouse model it bugsplats the first time I try to run it, but if I double click on the model file with Sketchup closed, so that the file opens and starts a new instance of Sketchup at the same time, it runs 'perfectly', despite the warning messages that the file is an older version and may not work. Sorry I can not be more help, but I cannot replicate what you describe.
Just curious, does this happen if you start with a empty file and create a very simple model such as a single SketchyPhysics cube falling under gravity?
This is what I have worked out. (Assume 60 frames = 1 second.) The actual velocity (v) is determined by:
v = (world scale)(setVelocity)(frame rate) inches/second.
In your model your world scale is set to 9.0 and you have scaled the velocity up by 4.38 which gives 9.0*4.38 = 39.4 which in effect has converted metres to inches because there are 39.37 inches in a meter.
The actual acceleration (a) is determined by:
a = (1/4) * (world scale) * (gravity) * (frame rate)^2 meters/second^2.
The vertical displacement (z) of the falling object is then given by z = (1/2)a(frames/60)^2
Yes, velocity is set in inches and acceleration is set in metres, no matter what units you have set Sketchup to use in the Window/Model Info menu! Well NASA crashed a Mars probe and wasted millions of dollars and years of work over a mixup between metric and imperial units, so SketchyPhysics is in good company. It seems to be just a coincidence that the magic figure of 4.38 works.
So for example to set an actual acceleration of 9.8 m/s in a metric model, set (world scale = 1), (gravity = 9.8) and (frame rate =2.0). Using the same parameters in the same model, to set an actual initial velocity of 3.2 m/s in the x direction, you would have to use setVelocity([63.04,0.0,0.0]) because 3.2*39.4/2 = 63.04
Hi Klaufi,
I have altered your code a little bit to use arrays for value and the new code illustrates various ways to iterate through, change and print out the the contents of an array. I think you will find the methods useful if your project gets more complex. I have also introduced a "case" construct for the counter, so that that the "move" procedure is not called 5 times every frame, which might speed things up a little. I hope you find the new code informative. Took me while to figure out how to do it, but it is all helping me learn Ruby. I just hope the Ruby etiquette police do not find out we have been using global variables. See the attached SU6 file but just in case that does not work, here is the code:
def getf(frm)
frm
end
f=getf(frame)
if f==0
$temp=0
$counter=1;$counter2=0
$value=[0.5,0.5,0.5]
$istpos=[0.5,0.5,0.5]
end
def move(zeit,sollpos,f)
if f>=$temp && f<=zeit+$temp;
if $counter != $counter2 # Only print to console if counter changes.
puts "$counter= #{$counter} zeit= #{zeit} sollpos= #{sollpos.inspect} frame= #{f} "
for i in (0..$value.length-1) # one way to iterate through array and print contents.
puts "$value[#{i}]= #{$value[i]} "
end
$counter2 = $counter
end
$value.each_with_index { |i,j| $value[j]=$istpos[j]+(sollpos[j]-$istpos[j])*(f-$temp)/zeit; } # Another way to iterate through an array.
end
if f==zeit+$temp+1
$temp=$temp+zeit
$counter=$counter+1
$istpos=sollpos
puts"$counter=#{$counter} $temp=#{$temp} "
puts"$istpos= #{$istpos.inspect} " #quick way to print array contents.
end
end
case $counter
when 1
move(150.00,[1,0.3,0.1],f)
when 2
move(300.00,[0,0.1,0.2],f)
when 3
move(20.00,[1,0.8,1],f)
when 4
move(500.00,[1.5,0.9,0.6],f)
when 5
move(20.00,[0,0.3,0.2],f)
when 6
puts "Programmed sequence ended."
$counter+=1
else
# do nothing
end
Note: I have re-uploaded the file to fix a small error on one line of code.
Hi again Klaufi,
Sorry I somehow missed your posts or I would have replied earlier. As I mentioned before I am a bit of Ruby Noob myself, so it helps me to play around with these problems. Here is what I found. First you need to use just "frame" and not "$frame". Secondly, while you can use frame in if equality tests, you can not use its value directly in calculations or even output its value using print or puts. (I don't know why that is and it does not really make sense.). The workaround is to create a function to get the frame number and then pass that frame number as an additional parameter to your "move" function/procedure. Anyway, I managed to get the program to run and reference the frame number in calculations. See the attached file. The code is hidden in the small cylinder and the capsule. The output is to the Ruby Console so you need to open that before running.
Cheers,
Kev.
P.S. Global $variables should be used with caution as they can cause big problems down the line if some other function in SketchyPhysics uses the same global variables. Best to try passing variables between modules as function parameters if you can.
P.P.S. Are you using SP 3.x or SP 3.2?
Hi rbarr,
I have made a number of changes to your model, but I think it now does what you intended it to do. I have moved the pivot point nearer to the front of the desk, increased the height of the desk top and chamfered the front of the top, all to provide clearance to allow the top to raise to a reasonable angle. I have also added an extra pivot and hinge at the back with a second slider. The back slider was trying to keep the top at right angles to itself, while the front slider was trying to tilt the top and this is part of what was causing the problems. I also re-grouped some of the joints. The original hinge joint was not grouped with anything, so that is why it would not move with the rest of the mechanism. Hope you like the result and let me know if you need any more help.
Kev.
That exact error is mentioned in other threads here http://forums.sketchucation.com/viewtopic.php?f=61&t=31262&start=45 and here http://www.sketchucation.com/forums/viewtopic.php?f=61&t=33128
It seems to be related to SP running on Mac OS earlier than X 10.6. Are you running SP on a Mac and if so what OS?
Also, if you have a lot of Sketchup plugins there might be a conflict, so it might be worth trying moving them all to a temporary folder and see if that cures the problem and then put the plugins back into the original plugin folder one by one to pinpoint where the conflict is. However that is a long shot and a lot of work, so the best thing might be to re-install SP 3.2 as that sometimes seems to fix problems.
Also, if you open Ruby Console from the Window menu of Sketchup and copy ans paste the text that appears when you run the model, it might help the real experts here tell you what is wrong.
Finally, this might work:
Find the ControllerCommands.rb file using the path shown in the error message and open it up in a text editor. Put a hash (#) in front of the line that contains "@sounds=SPSounds.new()" at around line 777 half way through the file and save the file. This will prevent any models that use sound from working, but on my PC it will allow models that do not use sound to work normally. This is just a temporary workaround fix until someone that really knows what they are doing, like CPhillips provides a proper fix. If that does not work, remove the hash you added and re-save ControllerCommands.rb to put everything back as it was.
Let me know if any of that works.
@unknownuser said:
No problem, I would really like to see how you modified the model, but I have SU6 and since SU7 didn't work on my notebook, SU8 might neither.
The pages look really helpfull, thanks, I will read them when I have more time.
Hi Klaufi,
I have saved the modified model as SU6 in the hopes that you might be able to load it, but maybe it is not that simple. Let me know how you get on. See attached.
Kev
Hi Klaufi,
I like the way you have designed the robot so that the "hand" moves in a straight line and maintains its orientation as the arms rotate. Nicely done!
I am a bit of noob at RUBY but I hope the following helps. I have put a callable procedure in the "OnTick" code box of the "face me" guy and this is called (with parameters) from some code in the "OnTouch" code box of the endeffector. Your original code that was hidden in the physics joint is now in the "OnTick" code box of the solid floor where it is easier to read and debug. See the attached updated file. I have also made it so that the gripper automatically closes when it touches a box and you have to press the spacebar to release the box. I hope you do not mind, I could not resist!
You will need to have the Ruby console open to see the print output of the procedure. It should be enough to get you started. The code in the attached file passes 3 variables to the procedure/function and returns one variable.
To return more than one value from a procedure see http://www.codeodor.com/index.cfm/2007/1/29/Functions-that-return-more-than-one-value/918
I also found these ruby web pages very helpful:
Ruby Tutorial with Code Samples
(www.fincher.org)
Kev
P.S. If you make further refinements to your robot arm, it would be nice to see updates here
@wasiur said:
(sketchyphysics Sketchup 7)
I just wanted to attach two pistons to a rectangular prism. One piston will go down and the other one will make it go sideways once it is down. Is there a better way of doing it. I need to export this as an animation. I can easily do it with proper animation plugin. But it wont allow me to export animation. So I need to do it using sketchyphysics. Please Help.
Thanks
See the attached file. The box at the back is set up to automatically go sideways, as soon as the box has moved to its lower limit, using the "ontouch" event. The box in the foreground has two pistons which can be used independently to move the box up/down and left/right. Hope one of these suits your requirements. Not sure how to export the end result as an animation.
Switch Layer 1 on to reveal the hidden box that acts as the intermediary between the two pistons.
@prismcnd said:
i as well am interested on how to create joined components that stick together (sketchyphysics?) a hint would be welcome
If you can elaborate on exactly what you are trying to achieve, I am sure we can help you achieve it. Do you mean how do make joint connections in general in Sketchyphysics, or do you have something more particular in mind?
I am asking the level of detail you require, because I do not want to offend you by explaining stuff you may know already. If you just a quick tutorial to get you started in SketchyPhysics I can do that very easily. I gather from your previous posts you already know your way around Sketchup itself.
@unknownuser said:
I wonder if the behavior I'm seeing in the speed test model is the same as what anyone else getting...
If I open the model and run the test a few times, I get around 25fps.
Then I turn on shadows and get around 62fps.
Then I turn off shadows and get around 62fps.Anyone else see this? Maybe this has something to do with SU 8? With shadows on when I run the ruby it basically turns the shadows off and zooms around it's orbit and then pops them back on. The even weirder thing though is when I turn the shadows back off, so it's in the same state as it was originally and the fps goes from 25 up to 62.
I have noticed a similar behaviour. If I run the first test with shadows on, I get around 21 fps with the large shadow cast on the ground displayed while orbiting and then on the second run I get around 31 fps but this time the large shadow is missing but the light/dark shading of individual spheres is still there. Now if I turn shadows off I get 31 fps and all subsequent tests achieve around around 31 fps with shadows on or off but the large shadow cat on the ground during orbiting never returns unless I restart Sketchup. For some reason this behaviour only happens if I start Sketchup by clicking on the test file rather than starting Sketchup and then loading the file.
The size of the display and the size of the window Sketchup is running in also makes a difference. Some older systems with slower CPUs and GPUs and low end laptops may seem to perform well relative to newer faster systems because they have lower resolution displays.
Here are some test runs on my system at 1980x1080 resolution (fullscreen):
1)Shadows ON: 20.8 fps (Shadow on ground during orbiting)
2)Shadows ON: 30.9 fps (No shadow on ground during orbiting)
3)Shadows OFF: 30.6 fps
4)Shadows ON: 30.6 fps (No shadow on ground during orbiting)
These tests run with screen resolution set at 1280x1024 (fullscreen):
1)Shadows ON: 25.7 fps (Shadow on ground during orbiting)
2)Shadows ON: 42.1 fps (No shadow on ground during orbiting)
3)Shadows OFF: 42.2 fps
4)Shadows ON: 42.5 fps (No shadow on ground during orbiting)
Final tests run at 1980x1080 resolution but Sketchup window only occupying about a 1/3 of the screen:
1)Shadows ON: 29.4 fps (Shadow on ground during orbiting)
2)Shadows ON: 55.5 fps (No shadow on ground during orbiting)
3)Shadows OFF: 53.9 fps
4)Shadows ON: 56.7 fps (No shadow on ground during orbiting)
To make more meaningful comparisons of different systems we probably need to know the resolution of the screens used, whether or not the test is fullscreen and whether or not large shadows on the ground are still displayed while orbiting.
This is my system running SU8:
P.S. Anyone fancy having a shot at this alternative test I started here http://forums.sketchucation.com/viewtopic.php?f=72&t=37045 . It does require you have the SketchyPhysics plugin but it will test different aspects of your system and maybe provide a challenge.
Hi MetalGear,
For a newbie you seem to have chosen some of the hardest things to do in SketchyPhysics and I must say your bevel gears are exceptional (I might "borrow" them for my own purposes ). You also did not make some of the basic mistakes I was expecting to find like joints not correctly connected or concave parts not made out of convex hull sub parts. So congrats! Here are some small things I found that I have fixed up in the attached file.
I am not sure exactly what you were trying to achieve with the top bar as it was just flopping around loose, so I have grouped it with the gear that contains the servo. There are two models in the file. The one with the yellow base is basically you original model with the hole fixed up and the one with the green base is a simpler version which uses a hinge instead of a hole. (The pin that passes through where the hole used to be is set to "ignore" and "no collision" in the UI so that there is no conflict.) The simpler version is much easier to make, uses less memory and CPU time and it looks the same externally and works much more precisely. Let me know if you need any clarification on anything. Anyway, the inportant thing is that your gears have stopped doing the jitterbug-fandango
This is a quick summary of the results so far (all with hardware acceleration turned on). Thanks all
Operating System, CPU @ GHz, Cores, Graphics card, Shadows ON / Shadows OFF
WIndows 7 32 bit, AMD Athlon II X4 620 @ 2.60 GHz, 4 core, ATI Radeon HD 4200, 8 fps / 19 fps
Windows 7 32 bit, Intel Core duo E7500 @ 2.93 Ghz, 4 core, Nvidea QuadroFX 380 LP, 22 fps / 34 fps
Windows 7 64 bit, Intel Core i5-2500K @ 3.30 Ghz, 2 core, Radeon HD 6800 Series , 15 fps / 57 fps
So far, all the listed cards benefit (in the region of an order of magnitude faster) from having OpenGL hardware acceleration enabled.