Piston and slider are the same, but I think...
-
Great point, i think it can be done, using gears, but if you do that, SketchUp and SketchyPhysics may suffer an application crash.
-
@unknownuser said:
Great point, i think it can be done, using gears, but if you do that, SketchUp and SketchyPhysics may suffer an application crash.
Not really, look at the example (found on the warehouse, or download from link)
It's not a real etch-e-sketch, because I'd need to be able to input a key to get rid of the emitters, and I can't do that. So they last for 3000 frames.Also, for moving/complex objects, worm gears are sometimes just not possible. I was trying to set up a movable camera for something, but there was no way I could include worm gears (well, no way without adding extra weight to the object, which I couldn't do)
-
An example of what I mean is this Etch-e-Sketch thing I made. It uses worm gears, but should I really need them?
http://sketchup.google.com:80/3dwarehouse/download?mid=cc25ee1885707f70ffa95f224611fcb6&rtyp=s7&fn=etch-e-sketchup&ctyp=sm&ts=1238859809000
Arrow keys to move, space to draw.
-
Sliders were in SP1 and Pistons were added in SP2. Even though they are very much the same and could have been one joint I left them in to retain backward compatibility.
Your right that it would be useful to have such a joint.
In the meantime you could do a few other things. One would be use a regular slider and then a thruster on the body to move it along the slider.
Another that would allow the keyboard to work would be do something like in a piston controller.
#Formatted for clarity. pos=getVar("pos"); pos=pos+(key("up")*0.02); pos=pos+(key("down")*-0.02); setVar("pos",pos); pos;
The last line tells the controller to set to the value of pos.
A shorter less easy to read version of the above.
pos=getVar("pos")+(key("up")*0.02)+(key("down")*-0.02);setVar("pos",pos);pos;
-
@cphillips said:
Sliders were in SP1 and Pistons were added in SP2. Even though they are very much the same and could have been one joint I left them in to retain backward compatibility.
Your right that it would be useful to have such a joint.
In the meantime you could do a few other things. One would be use a regular slider and then a thruster on the body to move it along the slider.
Another that would allow the keyboard to work would be do something like in a piston controller.
> #Formatted for clarity. > > pos=getVar("pos"); > pos=pos+(key("up")*0.02); > pos=pos+(key("down")*-0.02); > setVar("pos",pos); > pos; >
The last line tells the controller to set to the value of pos.
A shorter less easy to read version of the above.
> > pos=getVar("pos")+(key("up")*0.02)+(key("down")*-0.02);setVar("pos",pos);pos; > >
That is a very good code but i found a problem with the second version. I'm yet to try the first one. It ignores the min and max values when you run it
-
@sgt.a.johnson said:
That is a very good code but i found a problem with the second version. I'm yet to try the first one. It ignores the min and max values when you run it
First code won't copy and paste into text box. looks pretty much the same though
-
@sgt.a.johnson said:
That is a very good code but i found a problem with the second version. I'm yet to try the first one. It ignores the min and max values when you run it
Controllers usually allow values to exceed 0-1.0 (the min max values). That can be very useful in some cases.
If you want to clamp the values in the above example add:
if(pos>1.0);pos=1.0;elsif(pos<0.0)pos=0.0;end
-
@cphillips said:
@sgt.a.johnson said:
That is a very good code but i found a problem with the second version. I'm yet to try the first one. It ignores the min and max values when you run it
Controllers usually allow values to exceed 0-1.0 (the min max values). That can be very useful in some cases.
If you want to clamp the values in the above example add:
if(pos>1.0);pos=1.0;elsif(pos<0.0)pos=0.0;end >
Some reason adding that won't work. Im not good at code so perhaps i misunderstood what to do. i just copied and pasted first code in and then copied and pasted constraining code onto the end
-
@sgt.a.johnson said:
@cphillips said:
@sgt.a.johnson said:
That is a very good code but i found a problem with the second version. I'm yet to try the first one. It ignores the min and max values when you run it
Controllers usually allow values to exceed 0-1.0 (the min max values). That can be very useful in some cases.
If you want to clamp the values in the above example add:
if(pos>1.0);pos=1.0;elsif(pos<0.0)pos=0.0;end > >
Some reason adding that won't work. Im not good at code so perhaps i misunderstood what to do. i just copied and pasted first code in and then copied and pasted constraining code onto the end
I just typed that off the top of my head and made a few errors. Here is a correct version:
pos=getVar("pos")+(key("up")*0.02)+(key("down")*-0.02);if(pos>1.0);pos=1.0;elsif(pos<0.0);pos=0.0;end;setVar("pos",pos);pos
-
@cphillips said:
I just typed that off the top of my head and made a few errors. Here is a correct version:
> pos=getVar("pos")+(key("up")*0.02)+(key("down")*-0.02);if(pos>1.0);pos=1.0;elsif(pos<0.0);pos=0.0;end;setVar("pos",pos);pos
Thanks. that works. Ive just tried it in a servo and a motor aswell. Works on those too.
Advertisement