diff --git a/packages/ecs/src/ComponentFunctions.ts b/packages/ecs/src/ComponentFunctions.ts index cb6fd970e6..e3c9f000a2 100755 --- a/packages/ecs/src/ComponentFunctions.ts +++ b/packages/ecs/src/ComponentFunctions.ts @@ -508,6 +508,7 @@ export function _use(promise) { * Use a component in a reactive context (a React component) */ export function useComponent>(entity: Entity, Component: C) { + if (entity === UndefinedEntity) throw new Error('InvalidUsage: useComponent called with UndefinedEntity') if (!Component.stateMap[entity]) Component.stateMap[entity] = hookstate(none) const componentState = Component.stateMap[entity]! // use() will suspend the component (by throwing a promise) and resume when the promise is resolved diff --git a/packages/engine/src/avatar/systems/AvatarInputSystem.ts b/packages/engine/src/avatar/systems/AvatarInputSystem.ts index c242a8a4c5..42c41ec8d4 100755 --- a/packages/engine/src/avatar/systems/AvatarInputSystem.ts +++ b/packages/engine/src/avatar/systems/AvatarInputSystem.ts @@ -62,6 +62,8 @@ import { AvatarComponent } from '../components/AvatarComponent' import { applyInputSourcePoseToIKTargets } from '../functions/applyInputSourcePoseToIKTargets' import { setIkFootTarget } from '../functions/avatarFootHeuristics' +import { FollowCameraComponent } from '@etherealengine/spatial/src/camera/components/FollowCameraComponent' +import { FollowCameraMode } from '@etherealengine/spatial/src/camera/types/FollowCameraMode' import { getThumbstickOrThumbpadAxes } from '@etherealengine/spatial/src/input/functions/getThumbstickOrThumbpadAxes' const _quat = new Quaternion() @@ -260,6 +262,13 @@ const execute = () => { (buttons[StandardGamepadButton.StandardGamepadDPadUp]?.pressed ? -1 : 0) + (buttons[StandardGamepadButton.StandardGamepadDPadDown]?.pressed ? -1 : 0) + if (keyDeltaZ === 1) { + // todo: auto-adjust target distance in follow camera system based on target velocity + const follow = getOptionalComponent(controller.cameraEntity, FollowCameraComponent) + if (follow?.mode === FollowCameraMode.ThirdPerson || follow?.mode === FollowCameraMode.ShoulderCam) + follow.targetDistance = Math.max(follow.targetDistance, follow.effectiveMaxDistance * 0.5) + } + controller.gamepadLocalInput.set(keyDeltaX, 0, keyDeltaZ).normalize() controller.gamepadJumpActive = !!buttons.Space?.pressed || gamepadJump || doubleClicked diff --git a/packages/engine/src/interaction/functions/createUI.ts b/packages/engine/src/interaction/functions/createUI.ts index ca9f169a69..0148babac1 100755 --- a/packages/engine/src/interaction/functions/createUI.ts +++ b/packages/engine/src/interaction/functions/createUI.ts @@ -52,7 +52,7 @@ export function createUI(entity: Entity, uiMessage: string, isInteractable = tru color: new Color('#B9B9B9'), transmission: 1, roughness: 0.5, - opacity: 0.95, + opacity: 1, transparent: true, side: DoubleSide })