Setting properties on existing body with fixture and shape.

Hello,

Would it be possible to demonstrate a quick bit of code showing how one might set the density, friction and type such as b2_dynamic after creating as static? I would like to change things after making them.

Thanks a lot!
What I mean is, say I already have a body in the world doing things, bouncing etc - i'd like to change it to a kinematic sometimes or just change its properties while it exists (not its size etc).
I have solved it now. I am sorry if I have caused annoying with idiotic questioning. Provided below is the solution for people who might be searching for similar answers. This is useful if you are interested in wrapping box2D. To make a game, box2D really shines when wrapped:

Code:
void PSetDensity(b2Body* body , float density)
{
   //get fixture from body
   b2Fixture* fixture = body->GetFixtureList();
   
   //change density
   fixture->SetDensity(density);
   
   //recalculate mass
   body->ResetMassData();
}


Recalculate mass is probably required when changing density or the shape. It is not required for changing friction or restitution.

Original thread: https://box2d.org/forum/viewtopic.php?t=4465