Reputation: 1505
I'd like to know if there's a way to get and set the scale of a physicsjs body and have the bitmap assigned to the view of the body scale with it. I see no reference to scale in the state or geometry objects, and trying to set the width or height has no effect.
I'd like to increase the scale of a body and the bitmap assigned to its view.
Upvotes: 1
Views: 87
Reputation: 106
If you change the geometry on a body then you must then recalculate to get the change to take in the physics: https://github.com/wellcaffeinated/PhysicsJS/wiki/Bodies#recalculating
Additionally, if you're using the Pixi renderer or one of the other builtins, you will have to set the body's view to undefined to have it update on the graphics side as well: http://wellcaffeinated.net/PhysicsJS/docs/#Body-prototype-view
So for a specific body in the simulation someBody
which has a radius which isn't 20 already,
someBody.geometry.radius = 20;
someBody.view = undefined;
someBody.recalc();
Hope this answers your question.
Upvotes: 0