repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 3d60e7793e95bedeb6d0c5c4dde300383fd1755f:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 3d60e7793e95bedeb6d0c5c4dde300383fd1755f
Author: James Baicoianu 
Date:   Thu Oct 19 21:02:02 2017 -0700

    Better spawnpoint handling

diff --git a/scripts/room.js b/scripts/room.js
index 5153e3fdfc52a1bc981a54d389ef19a3baf5cfee..
index ..7232c08c01a0c392628dbd3075129c4b7dde910d 100644
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -54,6 +54,7 @@ elation.require([
       };
       this.playerstartposition = [0,0,0];
       this.playerstartorientation = new THREE.Quaternion();
+      this.spawnpoint = new THREE.Object3D();
       this.roomsrc = '';
       this.changes = {};
       this.deletions = [];
@@ -131,6 +132,8 @@ elation.require([
       this.createLights();
       this.setCollider('sphere', {radius: 1e4});

+      this.objects['3d'].add(this.spawnpoint);
+
       this.lastthink = 0;
       this.thinktime = 0;
       elation.events.add(this, 'thing_think', elation.bind(this, this.onScriptTick));
@@ -571,6 +574,13 @@ elation.require([
         this.playerstartposition = room.pos;
         this.playerstartorientation = room.orientation;

+        if (room.pos) {
+          this.spawnpoint.position.fromArray(room.pos);
+        }
+        this.spawnpoint.quaternion.copy(room.orientation);
+        //this.spawnpoint.quaternion.multiply(new THREE.Quaternion().setFromEuler(new THREE.Euler(0,Math.PI,0)));
+        this.spawnpoint.updateMatrixWorld();
+
         if (room.skybox_left_id) this.properties.skybox_left = room.skybox_left_id;
         if (room.skybox_right_id) this.properties.skybox_right = room.skybox_right_id;
         if (room.skybox_up_id) this.properties.skybox_up = room.skybox_up_id;

-----END OF PAGE-----