mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
worldupdate subbody repositioning - #99
This commit is contained in:
parent
2e01a093fc
commit
e370adf746
2 changed files with 42 additions and 0 deletions
|
|
@ -43,6 +43,30 @@ function (Parent, Settings, Nc) {
|
|||
}, Settings.RAGDOLL_DESTRUCTION_TIME * 1000);
|
||||
};
|
||||
|
||||
RubeDoll.prototype.getUpdateData = function(getSleeping) {
|
||||
var updateData = Parent.prototype.getUpdateData.call(this, getSleeping);
|
||||
|
||||
// if parent is asleep it sends null, to do no update
|
||||
if(!updateData) {
|
||||
return updateData;
|
||||
}
|
||||
|
||||
// adding limb update data
|
||||
var limbUpdateData = {};
|
||||
|
||||
for(var name in this.limbs) {
|
||||
limbUpdateData[name] = {
|
||||
p: this.limbs[name].GetPosition(),
|
||||
a: this.limbs[name].GetAngle(),
|
||||
lv: this.limbs[name].GetLinearVelocity(),
|
||||
av: this.limbs[name].GetAngularVelocity()
|
||||
};
|
||||
}
|
||||
updateData['limbs'] = limbUpdateData;
|
||||
|
||||
return updateData;
|
||||
}
|
||||
|
||||
RubeDoll.prototype.destroy = function() {
|
||||
if(this.scheduledForDestruction) {
|
||||
clearTimeout(this.destructionTimeout);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue