This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add button capture to camera input system (#8918)
* draft * Wasn't releasing properly fix * pr comments(acuum and camelcase) * Add better UX * Update LinkComponent.ts * Update LinkComponent.ts * Fix input bouncing bug, Change to location navigation * Create new engine hook for location moving in link component --------- Co-authored-by: HexaField <joshfield999@gmail.com>
- Loading branch information
1 parent
897fde3
commit 875ad01
Showing
13 changed files
with
287 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/engine/src/interaction/functions/nonInteractUI.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
CPAL-1.0 License | ||
The contents of this file are subject to the Common Public Attribution License | ||
Version 1.0. (the "License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE. | ||
The License is based on the Mozilla Public License Version 1.1, but Sections 14 | ||
and 15 have been added to cover use of software over a computer network and | ||
provide for limited attribution for the Original Developer. In addition, | ||
Exhibit A has been modified to be consistent with Exhibit B. | ||
Software distributed under the License is distributed on an "AS IS" basis, | ||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the | ||
specific language governing rights and limitations under the License. | ||
The Original Code is Ethereal Engine. | ||
The Original Developer is the Initial Developer. The Initial Developer of the | ||
Original Code is the Ethereal Engine team. | ||
All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023 | ||
Ethereal Engine. All Rights Reserved. | ||
*/ | ||
|
||
import { WebLayer3D } from '@etherealengine/xrui' | ||
|
||
import { Entity } from '../../ecs/classes/Entity' | ||
import { addComponent, getComponent } from '../../ecs/functions/ComponentFunctions' | ||
import { NameComponent } from '../../scene/components/NameComponent' | ||
import { TransformComponent } from '../../transform/components/TransformComponent' | ||
import { XRUIComponent } from '../../xrui/components/XRUIComponent' | ||
import { createNonInteractiveModalView } from '../ui/nonInteractiveModalView' | ||
|
||
export function createNonInteractUI(entity: Entity, message: string) { | ||
const ui = createNonInteractiveModalView(entity, message) | ||
const nameComponent = getComponent(entity, NameComponent) | ||
addComponent(ui.entity, NameComponent, 'ui-' + message + '-' + nameComponent) | ||
|
||
const xrui = getComponent(ui.entity, XRUIComponent) | ||
xrui.rootLayer.traverseLayersPreOrder((layer: WebLayer3D) => { | ||
const mat = layer.contentMesh.material as THREE.MeshBasicMaterial | ||
mat.transparent = true | ||
}) | ||
const transform = getComponent(ui.entity, TransformComponent) | ||
transform.scale.setScalar(1) | ||
|
||
return ui | ||
} | ||
|
||
export const updateNonInteractUI = (entity: Entity, xrui: ReturnType<typeof createNonInteractUI>) => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
packages/engine/src/interaction/ui/nonInteractiveModalView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
CPAL-1.0 License | ||
The contents of this file are subject to the Common Public Attribution License | ||
Version 1.0. (the "License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE. | ||
The License is based on the Mozilla Public License Version 1.1, but Sections 14 | ||
and 15 have been added to cover use of software over a computer network and | ||
provide for limited attribution for the Original Developer. In addition, | ||
Exhibit A has been modified to be consistent with Exhibit B. | ||
Software distributed under the License is distributed on an "AS IS" basis, | ||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the | ||
specific language governing rights and limitations under the License. | ||
The Original Code is Ethereal Engine. | ||
The Original Developer is the Initial Developer. The Initial Developer of the | ||
Original Code is the Ethereal Engine team. | ||
All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023 | ||
Ethereal Engine. All Rights Reserved. | ||
*/ | ||
|
||
import { createState } from '@hookstate/core' | ||
import React from 'react' | ||
|
||
import { Entity } from '../../ecs/classes/Entity' | ||
import { createXRUI } from '../../xrui/functions/createXRUI' | ||
import { useXRUIState } from '../../xrui/functions/useXRUIState' | ||
|
||
export interface ModalState { | ||
message: string | ||
} | ||
|
||
export const createNonInteractiveModalView = (entity: Entity, message: string) => { | ||
const ui = createXRUI( | ||
nonInteractiveModalView, | ||
createState({ | ||
message | ||
} as ModalState), | ||
{ interactable: false } | ||
) | ||
return ui | ||
} | ||
|
||
export const nonInteractiveModalView = () => { | ||
const modalState = useXRUIState<ModalState>() | ||
return ( | ||
<div className={'modal'}> | ||
<div className="hint" xr-layer="true" xr-pixel-ratio="1"> | ||
<div>{modalState.message.value}</div> | ||
</div> | ||
<link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet" type="text/css" /> | ||
<style> | ||
{` | ||
.modal { | ||
font-size: 60px; | ||
background-color: #000d; | ||
color: white; | ||
font-family: 'Lato', sans-serif; | ||
font-weight: 400; | ||
border: 10px solid white; | ||
border-radius: 50px; | ||
padding: 20px; | ||
margin: 60px; | ||
width: 400px; | ||
text-align: center; | ||
} | ||
`} | ||
</style> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.