Open andresz1 opened 8 years ago
Object.defineProperty(EZ3.Body.prototype, 'density', {
get: function() {
return this._body.shapes.density;
},
set: function(density) {
this._body.shapes.density = density;
this._body.setupMass(0x1, this.move);
}
});
Fixed, if I change the density, I should update the mass. By the way, do you think I should consider more than one shape per body?
@andresz1 for more than 1 shape per body, you should take advantage because that's defining a compound object, however if you only needed 1 shape per body that is fine. If you took a look at GoblinPhysics or cannon.js you would see that it's about the same concept.
Here are examples for compound shapes:
@xprogram Oh ok, thank you very much!
Hi I'm trying to do a body wrapper for my WebGL engine but changing the density of the shape doesn't work but changing the restitution does. Can you guys help me please. Here is the class code.
Besides that, do you guys think that is necessary to support more than one shape per body ?. I saw Babylon.js code and I think it doesnt.
Greetings and thanks