Browse Search Popular Register Upload Rules User list Login:
Search:
Superman training device.
If you howl and snarl loudly while watching the scene, then you will find you don't need a sound engine.
That's probably the difference. I'm not using b13. I'm using the latest v2.1.0 from http://www.algodoo.com/download/ which I think came after b13.
27
Xray - Thanks. I used my good eye. The game was so exciting, I almost had to change my diapers.
Now that you mention it, using the spring onKey event may be the simplest way to do it. Maybe next time I will try that.

Congratulations on recently becoming the top commenter.
This scene is intended for viewers as young as 3 years old who might not grasp the toggle idea. It also gives them an active part in driving the car and allows them to explore going frontwards and backwards. The light switch is the down key. There are only three controls (left, right, and down) which are very close together in order to keep it simple.
Thanks.
Launching satellites into orbit. Just needs a little work.
Nice work Benjii. :tup: :tup:
Good representation, well done.:tup: :tup:
I assume you wish to pixelate a polygon. You define a function within a defined function within a defined function. This is not good, for reasons that Xray has already mentioned. Each function needs to defined only once, not 105 times a second. I got an "out of memory" while running this scene. If you can explain what the "AnyOf" and "scene.my.displaySurface" functions are supposed to do, then maybe we can help.

P.S.: Here is how they can be run as three separate functions that need to be defined once in the console;

scene.my.xFor = (n1, n2, code)=>{
n2 > n1 ? {
m := (n1 + n2) / 2;
scene.my.xFor(n1, m, code);
scene.my.xFor(m + 1, n2, code)
} : {code(n1)}
};

scene.my.AnyOf = (ra, d, x, poly, disp)=>{
min := disp.pos + [50, 50];
n = string.length(ra) - 1;
Scene.my.xFor(0, n, (i)=>{
math.vec.dist(ra(i), d) < x ? {
min = poly.pos + (ra(i) / 2)
} : {}
});
min
};

scene.my.displaySurface = (poly, disp)=>{
sf = ((readable(poly)).surfaces)(0);
s = scene.my.AnyOf(sf, disp.pos, 0.25, poly, disp);
dist = math.vec.dist(s, disp.pos);
[0.0, 0.0, dist * 2.0, 1.0]
};

P.P.S.:

For each box
myBox = clone box
myPoly = clone polygon
newPoly = Intersect myPoly with myBox
V = 1 - newPoly.area/box.area
box.colorHSVA = [0,0,V,1]
Next
Last edited at 2014/02/11 10:18:43 by s_noonan
Although "scene.my.displaySurface" is only loaded once, it creates (2) functions (scene.my.xFor and AnyOf) each time it's called. Wit 64 boxes calling "scene.my.displaySurface" 105 times a second, it seems that the scene can create up to 13440 new functions a second (64 * 2 * 105). If you use the (3) independent functions shown in my previous response, then no new fuctions are created when the scene is running.

Regarding "AnyOf is supposed to read the nearest surface to each box.", it doesn't. The following should do what I think you intended:

scene.my.xFor = (n1, n2, code)=>{
n2 > n1 ? {
m := (n1 + n2) / 2;
scene.my.xFor(n1, m, code);
scene.my.xFor(m + 1, n2, code)
} : {code(n1)}
};

scene.my.displaySurface = (poly, disp)=>{
ra = scene.my.sf;
n = string.length(ra) - 1;
v = 100;
Scene.my.xFor(0, n, (i)=>{
d = math.vec.dist(poly.pos + ra(i), disp.pos);
d < v ? {v = d} : {}
});
disp.colorHSVA = [0.0, 0.0, 2 * v, 1.0]
};

in poly onSpawn:
scene.my.poly = entity;
scene.my.sf = (readable(owner)).surfaces(0);

in poly postStep:
pos = app.mousepos

in box postStep:
scene.my.displaySurface(scene.my.poly,en­tity)

At any rate, this does not pixelate the polygon but should pixelate the border of the polygon. I tried to design the code for minimum lag, but it didn't seem to help much.
Last edited at 2014/02/12 01:29:12 by s_noonan
Very Good.:tup: :tup:
Fun to watch at higher simulation frequency and speeds.
Thyme scripting. Keys control the axle. The axle is connected to the circle which is connected to the spring. Circle rotation is converted to spring length change and is passed from the circle to the spring. Increase the motor speed to increase slide speed.

I think there is a lot simpler way of doing this, which I may eventually do to this scene or in future scenes.
Last edited at 2014/02/13 16:11:41 by s_noonan
Does a Tesla coil emit x-rays?
Scene I uses a modified (corrected?)version of lololoer's code. Scene II works by magic.
Well OK, scene II works on the same principle as the 2D Printer.
Yes.
Thanks, it was the warnings on the high voltage rectifier vacuum tube section of old TV sets that prompted me to ask the question.
Good idea but caliper and vernier scale are incorrect. See vernier caliper. Motors may work better than Geometry controller.
Very good first scene. :tup: :tup:
Thanks for asking. I had thought that the "update" event happened every frame while "postStep" happens at sim.frequency. I tested this and I can see that they both run at the same rate.

P.S.
My test was flawed. The "update" event does happen every frame (usually at 60fps) and "postStep" does happen at sim.frequency.
Last edited at 2014/02/15 12:33:32 by s_noonan
Yes, it is slow. I'm open to suggestion.
Well done. :tup: :tup:
Good call, Xray. It looks like _mp constantly updates when in onKey but not when in postStep. Also, the code only needs to be in one object (the spring), not three. Use the Alt key to select just one object.
I didn't think to test at different frequencies. Thanks for checking that out.
Interesting.
Good.:tup:
previous | 1 … 32 33 34 35 36 … 121 | next