repo: janusweb action: commit revision: path_from: revision_from: 3cf6147f164fe51ee28ad22b04a48a35ed1ab008: path_to: revision_to:
commit 3cf6147f164fe51ee28ad22b04a48a35ed1ab008 Author: James BaicoianuDate: Tue Nov 2 01:19:42 2021 -0700 Fix spawnpoint position for portals nested in objects diff --git a/scripts/room.js b/scripts/room.js
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -256,7 +256,15 @@ elation.require([
if (links[i].url == referrer) {
//spawnpoint.position = links[i].position;
spawnpoint.position = links[i].localToWorld(V(0,0,player.fatness*2));
- spawnpoint.orientation = links[i].orientation.clone().multiply(new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0))); // Flip 180 degrees from portal orientation
+ spawnpoint.orientation = links[i].orientation.clone();
+ let node = links[i];
+ let roomproxy = this.getProxyObject();
+ while (node.parent && node.parent != roomproxy) {
+ node = node.parent;
+ node.handleFrameUpdates({});
+ spawnpoint.orientation.multiply(node.orientation);
+ }
+ spawnpoint.orientation.multiply(new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0))); // Flip 180 degrees from portal orientation
break;
}
}
@@ -819,8 +827,8 @@ elation.require([
links.forEach(link => {
let url = this.getFullRoomURL(link.url);
if (url == this.referrer) {
- this.spawnpoint.quaternion.copy(link.orientation.inverse());
- this.spawnpoint.position.fromArray(link.pos);
+ this.spawnpoint.quaternion.copy(link.orientation).invert();
+ this.spawnpoint.position.copy(link.pos);
this.spawnpoint.position.add(this.spawnpoint.localToWorld(V(0,0,-player.fatness)));
hasReciprocalLink = true;
}
-----END OF PAGE-----