Setting simulation passes per rendering pass from regularAPI

Report crashes, strange behaviour, or apparent bugs
Post Reply
rainlabs

Setting simulation passes per rendering pass from regularAPI

Post by rainlabs »

Hello,

I'm currently struggling with writing a plugin running simmulations, and I want to programmatically speed them up by setting number of simulation passes per rendering pass using function simSetSimulationPassesPerRenderingPass().

Here is a small part of my code:

Code: Select all

simInt aa = simInt(64);
simInt bb = simSetSimulationPassesPerRenderingPass( aa );
simInt cc = simGetSimulationPassesPerRenderingPass();
When I run it in debug mode, I can inspect that variable aa has (not suprisingly) value 64, variable bb has value 1 (which means that operation was successful), but variable cc also has value 1!

I was trying to put this code before calling simStartSimulation() and after it, with the same result.

Is it a bug or am I doing something wrong? :)

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Setting simulation passes per rendering pass from regula

Post by coppelia »

Hello,

This is not a bug, but poorly documented ;)

You can only set a different value with the API function simSetSimulationPassesPerRenderingPass if you have selected previously a custom simulation time step (i.e. custom dt) in the simulation settings dialog.

We corrected the return value and the documentation for next release, to avoid future confusions. Sorry about the trouble.

Cheers

rainlabs

Re: Setting simulation passes per rendering pass from regula

Post by rainlabs »

Thanks for the quick answer, now the mystery is solved. One more thing, would it be a problem for you to add a regular API function like simSetSimulationTimeStep()? Because now it's not possible to set this parameter without touching vrep's GUI at all, which is my goal.

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Setting simulation passes per rendering pass from regula

Post by coppelia »

You can already do this when simulation is stopped with following function:

simSetFloatingParameter(sim_floatparam_simulation_time_step,dt);

But here again, make sure that you selected a custom dt in the simulation settings dialog.

Cheers

Post Reply