scripts from the tutorials, etc

Let us know if you have a nice R.U.B.E script to share!
Post Reply
Posts: 2
Joined: Tue Jun 18, 2013 4:26 pm

scripts from the tutorials, etc

Post by TheSherman »


I am looking for scripts, which could be seen as design helpers.
For example Patternmakers which could arrange objects in a specified grid.
Maybe with an offset vallue
or a wavie (cos,sin) arrangement, which modifies the grid.


I could do that too, but if someone already has something fitting...

Moreover I am looking for the following scripts:

- which could generate the wavielines as seen in the Conveyor belts tut.
- the script for animating the wobble effect from the custom properties tut

Best regards
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: scripts from the tutorials, etc

Post by iforce2d »

Points on a grid can be found by a nested loop incrementing (x, y) coordinates. To get something like the image you attached, you would use eg. (x, sin(x)) and add a fixed vertical distance for each row. You could then set body positions using those locations, presuming it's bodies that you are wanting to arrange. If I'm missing something, maybe you could give a small example of the type of result you're looking for.

For arranging vertices, you could arrange the vertices of a fixture like this:

Code: Select all

for (int i = 0; i < f.getNumVertices(); i++)
	f.getVertex(i).setPos( i, sin(i) );
...or you could add new vertices like:

Code: Select all

for (int i = 0; i < 5; i++)
	f.addVertex( -1, i, sin(i) );
A wobble effect like in the custom properties demo would be done by your program after loading the scene. The RUBE scene just holds the properties to define what the speed/range will be.

One of the major benefits of scripting is that very specific functionality can be added a little bit at a time, without needing any extra work on the main program itself. If there is a specific script you would like to have, let me know and I can probably sort it out for you.
Post Reply