## How to change the gravity during the simulation

Typically: "How do I... ", "How can I... " questions
narutom
Posts: 5
Joined: 07 Jan 2019, 04:24

### How to change the gravity during the simulation

hello,
I am using Matlab to control the robot in V-rep.
But setting the gravity to -9.8m/s^2 at the initial stage will cause the mechanical structure to collapse.
So, I want a gradual change in gravity during the simulation.
Is there any API that can read and change the gravity during the simulation. Or I just need to change the gravity by hand?

thanks

fferri
Posts: 528
Joined: 09 Sep 2013, 19:28

### Re: How to change the gravity during the simulation

Hello,

you can change the gravity in the general dynamics properties.

You can also change gravity programmatically via sim.setArrayParameter(sim.arrayparam_gravity,{gx,gy,gz}).

Alternatively, you can apply forces/torques to objects via sim.addForce and sim.addForceAndTorque.