Portal exit positioning
This commit is contained in:
parent
c627489816
commit
e4be2c0783
|
@ -1,6 +1,6 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
|
|
||||||
Portal = <portal @name string @destination PortalDestination> .
|
Portal = <portal @name string @destination PortalDestination @position shapes.Vector3> .
|
||||||
PortalDestination =
|
PortalDestination =
|
||||||
/ @local #!any
|
/ @local #!any
|
||||||
/ @remote <remote <ws @url string> @sturdyref sturdy.SturdyRef>
|
/ @remote <remote <ws @url string> @sturdyref sturdy.SturdyRef>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
? <Scene ?name ?scene> [
|
? <Scene ?name ?scene> [
|
||||||
$scene [
|
$scene [
|
||||||
? <Exit ?spriteName ?roomName> [
|
? <Exit ?spriteName ?roomName> <Exit $spriteName $roomName <v 0.0 1.6 0.0>>
|
||||||
|
? <Exit ?spriteName ?roomName ?initialPos> [
|
||||||
$config ? <Scene $roomName ?ds> [
|
$config ? <Scene $roomName ?ds> [
|
||||||
$scene <portal $spriteName $ds>
|
$scene <portal $spriteName $ds $initialPos>
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<Exit "zball" "other">
|
<Exit "zball" "other">
|
||||||
<sprite "zball"
|
<sprite "zball"
|
||||||
<move <v 0.0 1.5 30.0>
|
<move <v 0.0 1.5 30.0>
|
||||||
<color 0.0 1.0 0.0
|
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"]
|
||||||
<touchable <sphere>>>>>
|
<touchable <sphere>>>>>
|
||||||
|
|
||||||
<sprite "plans"
|
<sprite "plans"
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
<v 0.0 0.0>]
|
<v 0.0 0.0>]
|
||||||
<floor <ground <v 300.0 300.0>>>>>
|
<floor <ground <v 300.0 300.0>>>>>
|
||||||
|
|
||||||
<Exit "home" "lobby">
|
<Exit "home" "lobby" <v 0.0 15.0 4.0>>
|
||||||
<sprite "home" <move <v 0.0 1.5 5.0> <color 1.0 0.0 0.0 <touchable <sphere>>>>>
|
<sprite "home" <move <v 0.0 1.5 5.0> <color 1.0 0.0 0.0 <touchable <sphere>>>>>
|
||||||
]
|
]
|
||||||
|
|
22
src/index.ts
22
src/index.ts
|
@ -55,6 +55,7 @@ async function enterScene(
|
||||||
runningEngine: RunningEngine,
|
runningEngine: RunningEngine,
|
||||||
ds: Ref,
|
ds: Ref,
|
||||||
sceneDs: Ref,
|
sceneDs: Ref,
|
||||||
|
initialPosition: Vector3,
|
||||||
email: Dataflow.Field<string>,
|
email: Dataflow.Field<string>,
|
||||||
) {
|
) {
|
||||||
const currentSceneFacet = Turn.activeFacet;
|
const currentSceneFacet = Turn.activeFacet;
|
||||||
|
@ -65,7 +66,7 @@ async function enterScene(
|
||||||
|
|
||||||
const camera = runningEngine.camera;
|
const camera = runningEngine.camera;
|
||||||
camera.applyGravity = false;
|
camera.applyGravity = false;
|
||||||
camera.position = runningEngine.options.initialPos.clone();
|
camera.position = initialPosition.clone();
|
||||||
|
|
||||||
interpretScene(id, runningEngine, rootMesh, sceneDs);
|
interpretScene(id, runningEngine, rootMesh, sceneDs);
|
||||||
|
|
||||||
|
@ -130,7 +131,8 @@ async function enterScene(
|
||||||
let needStop = true;
|
let needStop = true;
|
||||||
on asserted SceneProtocol.Portal({
|
on asserted SceneProtocol.Portal({
|
||||||
"name": o,
|
"name": o,
|
||||||
"destination": $dest: SceneProtocol.PortalDestination
|
"destination": $dest: SceneProtocol.PortalDestination,
|
||||||
|
"position": $targetPosition: Shapes.Vector3,
|
||||||
}) => {
|
}) => {
|
||||||
needStop = false;
|
needStop = false;
|
||||||
switch (dest._variant) {
|
switch (dest._variant) {
|
||||||
|
@ -138,7 +140,14 @@ async function enterScene(
|
||||||
runningEngine.scene.removeMesh(rootMesh, true);
|
runningEngine.scene.removeMesh(rootMesh, true);
|
||||||
Turn.active.stop(currentSceneFacet, () => {
|
Turn.active.stop(currentSceneFacet, () => {
|
||||||
react {
|
react {
|
||||||
enterScene(id, runningEngine, ds, dest.value, email);
|
enterScene(id,
|
||||||
|
runningEngine,
|
||||||
|
ds,
|
||||||
|
dest.value,
|
||||||
|
new Vector3(targetPosition.x,
|
||||||
|
targetPosition.y,
|
||||||
|
targetPosition.z),
|
||||||
|
email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -220,7 +229,12 @@ function bootApp(ds: Ref, runningEngine: RunningEngine) {
|
||||||
at remoteDs {
|
at remoteDs {
|
||||||
stop on asserted SceneHandle($sceneDs_e: Embedded) => {
|
stop on asserted SceneHandle($sceneDs_e: Embedded) => {
|
||||||
react {
|
react {
|
||||||
enterScene(id, runningEngine, ds, sceneDs_e.embeddedValue, email);
|
enterScene(id,
|
||||||
|
runningEngine,
|
||||||
|
ds,
|
||||||
|
sceneDs_e.embeddedValue,
|
||||||
|
runningEngine.options.initialPos,
|
||||||
|
email);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue