Page 1 of 1

Enable simulation stepping from script

Posted: Thu May 29, 2014 1:23 pm
by NauticalMile
I've noticed that there isn't a way to step the simulation directly from the script. There is no reference to such a function in the help, and when I check out the logs to see what happens when I step the simulation, I just calls translate and rotate commands on all the selected bodies to place them in their final position after stepping.

I would like to be able to call a step function with the signature

Code: Select all

void step(body[] bodiesToStep, uint numSteps, float simSpeed = 1.0)
where simSpeed is a variable that acts like the speed control in the player (i.e. <1.0 for slower than normal, and >1.0 for faster than normal).

If this is enabled, I can use a rubescript and a sampler to create a series of images of the a simulation (using a sampler), without the hassle of trying to record a gif of the player running. Then I can use some other program to compile those images into a gif/video for a nice clean demonstration.

The problem is, when I record a gif from the player, my cpu gets bogged down trying to do the sim and recording at once, and the frame rate starts to get choppy, making for poor video quality. This solution would sidestep that issue.

Re: Enable simulation stepping from script

Posted: Thu May 29, 2014 3:15 pm
by iforce2d
Everything that RUBE ever does to the scene is done by a script, and you can find the source of all the scripts for the action menu in the config/actionMenu/default folder where your RUBE is installed. The function signature is:

Code: Select all

void step(body[] bodies, int numSteps)
This is actually mentioned in the help but the help-text search feature is pretty terrible, it only seems to find full words, never partial matches... :?

Re: Enable simulation stepping from script

Posted: Thu May 29, 2014 6:44 pm
by NauticalMile
Awesome, thanks. I should have looked a little more before posting.