summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index fc1ccbe..dadcd53 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -10,6 +10,11 @@
vec2 = require('./vec2')
Rect = require('./rect')
UidGenerator = require('../util/uid')
+ wall_rotation = {}
+ wall_rotation[FRONT] = PI
+ wall_rotation[BACK] = 0
+ wall_rotation[LEFT] = HALF_PI
+ wall_rotation[RIGHT] = -HALF_PI
}
var Wall = function(opt){
@@ -18,6 +23,7 @@
this.edge = opt.edge
this.side = opt.side
this.surface = opt.surface
+ this.rotationY = ('rotationY' in opt) ? opt.rotationY : wall_rotation[opt.side]
this.mx = opt.mx
this.background = { src: "none" }
}
@@ -89,7 +95,7 @@
mx_dot.move(mx_pos)
mx_dot.width = 5
mx_dot.height = 5
- mx_dot.rotationY = wall_rotation[base.side]
+ mx_dot.rotationY = base.rotationY
mx_dot.el.style.backgroundColor = "red"
scene.add(mx_dot)
}
@@ -192,7 +198,7 @@
}
Wall.prototype.serialize = function(){
- return {
+ return {
id: this.id,
background: this.background,
}
@@ -236,7 +242,7 @@
x: x,
y: position.b + dimension.b / 2,
z: z,
- rotationY: wall_rotation[ this.side ],
+ rotationY: this.rotationY,
}
}
Wall.prototype.mxToPosition = function(mx, dimension) {