mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed a few bugs - rube loader was manipulating the json, which resulted in coordinates flipping every second time
This commit is contained in:
parent
ca1ca7635b
commit
cd956b8a28
1 changed files with 3 additions and 4 deletions
7
app/Lib/Vendor/RubeLoader.js
vendored
7
app/Lib/Vendor/RubeLoader.js
vendored
|
|
@ -152,8 +152,7 @@ function (Box2D) {
|
||||||
if ( bodyJson.hasOwnProperty('linearVelocity') && bodyJson.linearVelocity instanceof Object )
|
if ( bodyJson.hasOwnProperty('linearVelocity') && bodyJson.linearVelocity instanceof Object )
|
||||||
bd.linearVelocity.SetV( bodyJson.linearVelocity );
|
bd.linearVelocity.SetV( bodyJson.linearVelocity );
|
||||||
if ( bodyJson.hasOwnProperty('position') && bodyJson.position instanceof Object )
|
if ( bodyJson.hasOwnProperty('position') && bodyJson.position instanceof Object )
|
||||||
bodyJson.position.y *= -1;
|
bd.position.SetV( this.getVectorValue(bodyJson.position) );
|
||||||
bd.position.SetV( bodyJson.position );
|
|
||||||
if ( bodyJson.hasOwnProperty('awake') )
|
if ( bodyJson.hasOwnProperty('awake') )
|
||||||
bd.awake = bodyJson.awake;
|
bd.awake = bodyJson.awake;
|
||||||
else
|
else
|
||||||
|
|
@ -169,6 +168,7 @@ function (Box2D) {
|
||||||
body.name = bodyJson.name;
|
body.name = bodyJson.name;
|
||||||
if ( bodyJson.hasOwnProperty('customProperties') )
|
if ( bodyJson.hasOwnProperty('customProperties') )
|
||||||
body.customProperties = bodyJson.customProperties;
|
body.customProperties = bodyJson.customProperties;
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,8 +231,7 @@ function (Box2D) {
|
||||||
|
|
||||||
RubeLoader.prototype.getVectorValue = function (val) {
|
RubeLoader.prototype.getVectorValue = function (val) {
|
||||||
if ( val instanceof Object ) {
|
if ( val instanceof Object ) {
|
||||||
val.y *= -1;
|
return { x: val.x, y: val.y * -1 };
|
||||||
return val;
|
|
||||||
} else {
|
} else {
|
||||||
return { x:0, y:0 };
|
return { x:0, y:0 };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue