repo: janusweb action: commit revision: path_from: revision_from: 3d60e7793e95bedeb6d0c5c4dde300383fd1755f: path_to: revision_to:
commit 3d60e7793e95bedeb6d0c5c4dde300383fd1755f Author: James BaicoianuDate: Thu Oct 19 21:02:02 2017 -0700 Better spawnpoint handling diff --git a/scripts/room.js b/scripts/room.js
--- 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-----