improving rube doll flipping behaviour and positioning

This commit is contained in:
logsol 2015-05-06 20:15:22 +02:00
parent ec7ce459cb
commit 6d8609b475
11 changed files with 383 additions and 360 deletions

View file

@ -33,7 +33,7 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) {
this.body.SetUserData(this);
this.flip(options.direction);
this.flip(options.direction || 1);
}
RubeDoll.prototype = Object.create(Parent.prototype);
@ -41,6 +41,8 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) {
RubeDoll.prototype.loadRubeDollFromScene = function(options) {
var scene = this.rubeLoader.getScene();
for (var i in scene.bodies) {
var body = scene.bodies[i];
var position = body.GetPosition().Copy();
@ -50,6 +52,15 @@ function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, RubeDollJson) {
));
body.SetPosition(position);
this.limbs[body.name] = body;
// code snipped possibly needed for filtering between doll and rubedoll while holding
//var filterData = new Box2D.Dynamics.b2FilterData();
//filterData.groupIndex = -66;
//if(body.name != "head" && body.name != "chest") {
// for (var fixture = body.GetFixtureList(); fixture; fixture = fixture.GetNext()) {
// fixture.SetFilterData(filterData);
// }
//}
}
this.joints = scene.joints;