Sorry, I don't know any way... maybe there is an adaptation of [1,2,3,4][(frame/50)%4] that changes when you press something. Variables need to be refreshed every frame, so no luck there... why not just use an emitter?
(Your tank is awesome BTW )
Sorry, I don't know any way... maybe there is an adaptation of [1,2,3,4][(frame/50)%4] that changes when you press something. Variables need to be refreshed every frame, so no luck there... why not just use an emitter?
(Your tank is awesome BTW )
Ohhhh... I was assuming they would be. Maybe something for a future release?
This is my attempt at a script that toggles between 1 and 0 when a is pressed.'toggle' is the output value, and can be either 0.0 or 1.0. 'allow_repeat' is intended to stop the script from excecuting again until a is released. The frame detector is just to stop 'toggle' being re-declared as 0.0 every time the script restarts. In sketchyphysics, it just acts like a is the controller.
if(frame<5);toggle=0.0;elsif(a==0.0);allow_repeat=1.0;elsif(allow_repeat==0.0);toggle;elsif(a==0.0);toggle;elsif(toggle==0.0);allow_repeat=0.0;toggle=1.0;else;allow_repeat=0.0;toggle=0.0;end
Can anyone help?? Is there a proper way of doing this (mine seems overly complicated)??
That is what I mean... it makes it effectively unusable for anything involving dynamic, analogue input. I can't see there being a way around this without delving into the fabric of sketchyphysics, so just leave it to Chris.
@unknownuser said:
Wacov; your script changes the distance to larger, and speed to slower, the more you move it left.
...So here's a model with a few tries at changing speed only. right one is just plain oscillator(50), middle one works best, but is reversed for some reason, and the order can't be reversed. one on the left is the one that, to me, makes no sense at all, and I think it's a bit funny so I posted it.
[attachment=0:xf9qtpt5]<!-- ia0 -->test_session.skp<!-- ia0 -->[/attachment:xf9qtpt5]
NOTE: use arrow keys.
Hmmm... I don't think the distance is less, it's just the joint trying to keep up with the oscillator, which is changing direction before the joint can get where it's supposed to be. Yours is better, but it it still spazzes out when you use a slider or joystick for the control
Just hope Chris comes up with something, or there won't be any controllable walkers...
@cphillips said:
@unknownuser said:
Wacov, i'm not sure you can call it a concave hull. If it just read concave, then it wouldn't register any convex faces. i think it is impossible to have a fully concave object. even a bent face is still convex. I don't exactly get why there can't be a movable mesh, because a group of multiple facets is more complicated then a mesh of identical polygons. those facets are components, and the more components you have, the slower it gets. Could there be some other physics engine alternative, like a plugin engine that can be switched from the newton to the other?
The physics engine does not allow concave because it is very difficult (slow) to determine if concave objects collide. It wouldn't really be feasible to change out the physics engine at this point. I would have to start over. Sorry.
No, it's definately a concave hull... don't ask me why. Newton Dynamics isn't the most amazing engine in the world, but it's free and gets the job done. And, like Chris said, there's no way it's changing.
Try "oscillator(slider("controller")*50)". Unfortunately, it won't work the way either of us want it to (it resets to the start position every time the controller is changed) To be honest, I'm not an expert... everything I knew about IF functions went into that post
Basically, all the IF does is ask if something's true or false. A simple 'question' would be:
(1.0<0.5)
This checks whether 1.0 is less than 0.5. Obviously, it's not, so that would result in a false. In the script, you have the question, then what value to return if it's true, then what value to return if it's false (The value can itself be another script, but let's not get into that ) So, if the value for true is "1.0", and the value for false is "0.0", then our script of:
if(1.0<0.5);1.0;else;0.0;end
Would return the false value of "0.0" as the controller for the joint, or whatever you're controlling. (the ";" separates what, in a normal script, would be line breaks)
Some stuff for the question:
"<" = Less than
">" = Bigger than
"==" = Equal to
"<=" = Less than or equal to
">=" = Bigger than or equal to
Ok, it's brilliant that we can use scripts and formulas... but why do we have to put it all in one line?? Here's a script:
if(lefty==1.0);0.0;elsif(lefty<0.3);Math.sin(frame/3.0)/3;else;Math.sin(frame/(lefty*10))/3;end
It's very, very annoying to scroll sideways through something like this, and error checking is that much harder without being able to see the bigger picture. I'm actually not very clear on the multiple-line scripting, but it'd make more sense that this; even if it's not till SPIV, I feel a multiple-line formula/script box is very important.
It's because when the object a gear is on is rotated, it doesn't affect the gear it's connected to; the connected gear is only affected when the gear moves in relation to the object it's attached to. Also, if one gear's object is rotated around the gear it's connected to, it has no effect; for a differential to work, it's crucial that this is fixed. Gears need to be far more dynamic if complex mechanisms like differentials will work.
The ignore suggestion will only work if the overall group's shape is set to 'default'. The first group in this model contains two grouped boxes; one is normal, the other is set to ignore... you can apply this to your model by having a hidden box set to ignore surrounding the actual geometry, as shown with the second group.
Every new user asks this, including me. Like Chris said, It's not possible with the Newton Physics engine, which SketchyPhysics uses. He can't edit the engine, so we can't have 'moving meshes' (They're actually called concave hulls).
But, seriously, remove the embedded images, and the links. Upload your pics and files straight from your computer, into the post, using the forum's system, and place them inline.
I know for a fact that differentials aren't currently possible in SP without actually making shapes that mesh together. Chris, this model shows what a differential is there for (power distribution), and how it's supposed to work... if more resistance is induced on either wheel, a differential allows the power to be shifted to the other wheel; in the model, the blue parts would connect to the wheels.
The animation shows how a real differential works, and the slider conrols how much 'resistance' there is on each side.(NOTE: It's not a simulation of a differential, and WILL NOT WORK in a dynamic model. There are no gears, just motors to show what the gears would be doing)
Yeees thanks very much!
I was wondering if it was a plugin...
@bigbjason said:
@unknownuser said:
I know that -(a)*50 can be used for emitting guns, [0,2,3,4,5][(frame/50)%5] can be used for timed and automatic machine movement.
Can someone explain to me how to use these two scripts?
Scripts can go in any of the blue boxes in the UI, while you have a joint or group selected. The 'Controller' box for joints controls the joint; normally this needs a script that results in a value between 0.0 and 1.0, but you can have any value you like (with unexpected results). If you include them in boxes in the 'Properties' section, they'll control emitter/thruster/magnet settings. In these boxes you can use any combination of fixed settings/ scripts... for example, to have a controlled emitter, you could have a setting of 20 in the 'rate' box (fires every 20 frames) and a script of "key('space')*100" in the strength box (this would fire when you press space, with a force of 100). The 'Lifetime' setting isn't a blue box; this means it has to be determined before the simulation starts. Leaving it at 0 would mean the emitted objects stay for the remainder of the simulation, but any number over this determines the number of frames the object survives for.
To use the script Physicsguy describes ([0,2,3,4,5][(frame/50)%5]), you should understand what it does; the first [] holds the list of values the script cycles through, and the second [] tells it how often to change (In this case, every 50 frames). The %number resets it to the beginning when it's done, with the number being the number of values (5).
I thought I'd add the IF function to this; it's pretty versatile, and for those that don't know, it performs a logical test that results in an answer of 'True' or 'False'. Here's an example:
if(key('space')==1.0);2.0;else;0.5;end
This asks if the input from the spacebar is 1.0 (being pressed). If it is (True), it returns a value of 2.0 . If it isn't (False), it returns 0.5 .
You can also use else-IF. So:
if(key('space')==1.0);2.0;elsif(key('a')==1.0);0.0;else;0.2;end
Notice that it's spelt 'elsif', without an 'e'. This returns 0.2 by default. If a is pressed, it returns 0.0, and if space is pressed, 2.0 . The space will 'override' a, so if both are pressed, it will still return 2.0 . As far as I know, you can use as many 'elsif's as you like. You can also put scripts, like Physicguy's, as the values returned by the IF function.
If anyone doesn't understand this, don't worry, just ask. I hope this helps!
Ok, I knew how to do that. What I mean is, how do people make the really, really complicated frames and pipes etc.? In this example, how would I get the circle to follow all through the frame I've drawn in lines, or would I have to make it a different way?
Say I want to round off the highlighted edges:
If I have them selected, and using the follow me tool, click on the arc I've drawn, it tells me "This does not appear to be a valid path". If I try just dragging the shape around the path, it removes geometry when I go over it twice, which I need to do to follow the path.
There are models on the warehouse with complex tubular frames (like buggies), and boxes with many sides rounded off. It seems like they're made with the follow me tool, but if I try and use it in this way, it doesn't work... am I doing it wrong, or do they make it some other way?
Sorry if I'm wrong but I THINK that this is a problem with the physics engine, not the way it's been implemented into SketchUp. It's probably something to do with the way joints work, and Chris can't change the engine; we just have to live with it for now.
With this code, you can sequence emitters; Fire with A. (This took literally 2 minutes to make, I'm not claiming it's a masterpiece)
You can SORT of do this with a combination of follow and track, but it's hard to get right. A mode where the camera locks to an object, and moves in relation to it, including pitch, roll and yaw, would be useful. Maybe a proper camera setting somewhere in the UI?