leggedrobotics / raisimLib

RAISIM, A PHYSICS ENGINE FOR ROBOTICS AND AI RESEARCH
http://www.raisim.com
327 stars 50 forks source link

The SingleBodyObject::setMass() method #55

Closed christophecricket closed 4 years ago

christophecricket commented 4 years ago

Hi Again

I posted an issue 3 months back about there not being a setMass() method for rigid objects, which you solved ( https://github.com/leggedrobotics/raisimLib/issues/45 ).

However, I'm calling setMass() during my simulation runtime, feeding an object with a time-varying mass, and I have the problem that the output of getMass() is always the value of the first setMass() call, so the mass doesn't actually vary with time. My simulation output is also consistent with a time-static mass.

Is this expected behaviour? Or am I just potentially doing something wrong?

jhwangbo commented 4 years ago

I just tested it and the method works fine. Actually, setMass is mass_=mass; and getMass is return mass_;. If you share a snippet of your code, I might be able to comment on what you did wrong

christophecricket commented 4 years ago

I just looked at it again and I wasn't calling setMass() in the correct loop. I fixed that and now it's working fine. Sorry for wasting your time.