Skip to content
Browse files

Hackish solution for syncing yaw of PhysicalMapmodels with sauer

  • Loading branch information...
1 parent d542acb commit aa837a04c9d7a690639ba9cdf7c3febe4e815523 Alon Zakai committed Apr 11, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 packages/library/1_3/Physics.js
View
17 packages/library/1_3/Physics.js
@@ -557,6 +557,23 @@ PhysicalMapmodel = registerEntityClass(bakePlugins(Mapmodel, [
clientActivate: function() {
this.connect('client_onModify_modelName', this.refreshModel);
+
+ // Hackish way to ensure yaw is in sync, as yaw changes in sauer code are not
+ // noticed by us. FIXME: Perhaps update from in there?
+ this.lastYaw = -1000;
+ GameManager.getSingleton().eventManager.add({
+ secondsBetween: 1.0,
+ func: bind(function() {
+ if (this.physicsHandle !== undefined) {
+ if (this.yaw !== this.lastYaw) {
+ Physics.Engine.setRotation(this, new Vector4().quatFromAxisAngle(new Vector3(0,0,1), this.yaw+180).asArray());
+ this.lastYaw = this.yaw;
+ }
+ }
+ }, this),
+ entity: this,
+ });
+
},
createPhysicalObject: function(modelName) {

0 comments on commit aa837a0

Please sign in to comment.
Something went wrong with that request. Please try again.