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