Enable simulation stepping from script

What would you like to see in future versions of the editor?
Post Reply
NauticalMile
Posts: 11
Joined: Wed Apr 09, 2014 1:56 am

Enable simulation stepping from script

Post by NauticalMile » Thu May 29, 2014 1:23 pm

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.

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Enable simulation stepping from script

Post by iforce2d » Thu May 29, 2014 3:15 pm

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... :?

NauticalMile
Posts: 11
Joined: Wed Apr 09, 2014 1:56 am

Re: Enable simulation stepping from script

Post by NauticalMile » Thu May 29, 2014 6:44 pm

Awesome, thanks. I should have looked a little more before posting.

Post Reply