mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
39 lines
No EOL
855 B
JavaScript
Executable file
39 lines
No EOL
855 B
JavaScript
Executable file
define([
|
|
"Game/Core/GameObjects/GameObject",
|
|
"Lib/Vendor/Box2D"
|
|
],
|
|
|
|
function (Parent, Box2D) {
|
|
|
|
"use strict";
|
|
|
|
function GameObject(physicsEngine, uid) {
|
|
Parent.call(this, physicsEngine, uid);
|
|
}
|
|
|
|
GameObject.prototype = Object.create(Parent.prototype);
|
|
|
|
GameObject.prototype.getUpdateData = function(getSleeping) {
|
|
|
|
if (!this.body) {
|
|
return null;
|
|
}
|
|
|
|
if (this.body.GetType() === Box2D.Dynamics.b2Body.b2_staticBody) {
|
|
return null;
|
|
}
|
|
|
|
if (!getSleeping && !this.body.IsAwake()) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
p: this.body.GetPosition(),
|
|
a: this.body.GetAngle(),
|
|
lv: this.body.GetLinearVelocity(),
|
|
av: this.body.GetAngularVelocity()
|
|
};
|
|
}
|
|
|
|
return GameObject;
|
|
}); |