mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
improving rube doll flipping behaviour and positioning
This commit is contained in:
parent
ec7ce459cb
commit
6d8609b475
11 changed files with 383 additions and 360 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue