Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocap pose based interactions #9255

Merged
merged 71 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d670056
sitting animation, reintegrate mount point system, animation graph logic
AidanCaruso Oct 25, 2023
9d90ba5
fix animations not looping due to fade logic error
AidanCaruso Oct 26, 2023
2356e32
make mount point system actually work
AidanCaruso Oct 26, 2023
25db1c8
fix y position in seated mocap
AidanCaruso Oct 27, 2023
030d9b3
Improve animation handling
AidanCaruso Oct 27, 2023
61d4a5a
restore
AidanCaruso Oct 27, 2023
5a4c856
Prevent movement system on capture page instance
AidanCaruso Oct 28, 2023
70b8895
Set rotation
AidanCaruso Oct 29, 2023
cc71949
Merge branch 'dev' into sitting
AidanCaruso Oct 30, 2023
b3f6823
maxDistance and positioning changes
AidanCaruso Oct 30, 2023
e10a729
Fix interactable XRUI, bone world position hotfix
AidanCaruso Oct 31, 2023
73c364f
Fix locomotion getting stuck at last value
AidanCaruso Nov 1, 2023
2cb0282
dismount point
AidanCaruso Nov 2, 2023
ceb748e
networked seating to keep track of seated users
AidanCaruso Nov 2, 2023
1b1a6fa
add disclaimer
AidanCaruso Nov 2, 2023
36a23d9
xrui workaround
AidanCaruso Nov 3, 2023
5bb8233
Merge branch 'dev' into sitting
AidanCaruso Nov 3, 2023
90eb15d
switch to disable/start system
AidanCaruso Nov 3, 2023
ae9a8a3
Merge branch 'dev' into sitting
AidanCaruso Nov 5, 2023
f10318a
Merge branch 'dev' into sitting
AidanCaruso Nov 6, 2023
43a1e5c
Merge branch 'dev' into sitting
AidanCaruso Nov 7, 2023
24a96d7
fix system reference
AidanCaruso Nov 7, 2023
4e5a6cd
strict type checks
AidanCaruso Nov 7, 2023
3de2d35
stop using action queue for networked actions
AidanCaruso Nov 7, 2023
d1bac16
fixes
AidanCaruso Nov 7, 2023
95e4107
Merge branch 'dev' into sitting
AidanCaruso Nov 8, 2023
9391d2c
use xr friendly lookat for interactable xrui tips
AidanCaruso Nov 8, 2023
507ed49
restore hint hiding for occupied mounts
AidanCaruso Nov 8, 2023
e267826
revert move avatar change
AidanCaruso Nov 8, 2023
1373cdc
Merge branch 'dev' into sitting
AidanCaruso Nov 8, 2023
a672dee
pose detection
AidanCaruso Nov 10, 2023
930e0f0
license
AidanCaruso Nov 10, 2023
0ef0b2b
remove unnecessary system start
AidanCaruso Nov 10, 2023
d31cbcc
Merge branch 'sitting' into mocap-pose-interaction
AidanCaruso Nov 10, 2023
d3bf18a
test sitting interaction
AidanCaruso Nov 10, 2023
e7297f0
logic now goes both ways for seated/stood up
AidanCaruso Nov 13, 2023
ec19b34
stand condition
AidanCaruso Nov 14, 2023
e7c4444
Merge branch 'mocap-pose-interaction' of https://github.com/ethereale…
AidanCaruso Nov 14, 2023
ef36ae2
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 14, 2023
d952bf0
add unmount interaction case
AidanCaruso Nov 15, 2023
3f75e9d
fix pose input logic
AidanCaruso Nov 15, 2023
e9f6a21
logical fix
AidanCaruso Nov 15, 2023
6cb4192
logic
AidanCaruso Nov 15, 2023
7008bda
fix
AidanCaruso Nov 16, 2023
a5e32dc
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 16, 2023
edf23a8
initial rotation snapping
AidanCaruso Nov 17, 2023
d846eb9
mocap logic
AidanCaruso Nov 17, 2023
1b5c3a7
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 17, 2023
fc18466
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 21, 2023
0631056
refactor networked interactions
AidanCaruso Nov 22, 2023
da5607a
add licensing
AidanCaruso Nov 22, 2023
37a0cb5
Merge remote-tracking branch 'refs/remotes/origin/mocap-pose-interact…
AidanCaruso Nov 22, 2023
ebb1de4
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 22, 2023
987ed77
begin adding case for mocap poses
AidanCaruso Nov 22, 2023
88f12a9
interact refactor part 1
AidanCaruso Nov 25, 2023
0435e18
Mount inputs
AidanCaruso Nov 26, 2023
e1856d3
condition
AidanCaruso Nov 26, 2023
677373b
address grabbable regressions, remove onInteract
AidanCaruso Nov 26, 2023
8d62e75
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 26, 2023
ebbe91f
Cleanup
AidanCaruso Nov 27, 2023
354d12d
cleanup and improvements
AidanCaruso Nov 27, 2023
ba6c6da
set position more concisely
AidanCaruso Nov 27, 2023
835391d
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 28, 2023
cf95459
remove line
AidanCaruso Nov 28, 2023
824d86a
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Nov 29, 2023
cd72222
remove log
AidanCaruso Nov 29, 2023
dbfb5c0
Merge branch 'mocap-pose-interaction' of https://github.com/ethereale…
AidanCaruso Nov 29, 2023
232abf3
Merge branch 'dev' into mocap-pose-interaction
HexaField Nov 29, 2023
8423036
Add mount point to apartment chair
AidanCaruso Nov 29, 2023
8aad499
minor fixes
AidanCaruso Dec 5, 2023
e79d5ac
Merge branch 'dev' into mocap-pose-interaction
AidanCaruso Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/engine/src/avatar/functions/avatarFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export const createIKAnimator = async (entity: Entity) => {
const rigComponent = getComponent(entity, AvatarRigComponent)
const animations = await getAnimations()
const manager = getState(AnimationState)
const avatar = getComponent(entity, AvatarComponent)

for (let i = 0; i < animations!.length; i++) {
animations[i] = retargetMixamoAnimation(
Expand Down
34 changes: 2 additions & 32 deletions packages/engine/src/avatar/systems/AvatarInputSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ import { Quaternion, Vector3 } from 'three'

import { isDev } from '@etherealengine/common/src/config'
import { EngineState } from '@etherealengine/engine/src/ecs/classes/EngineState'
import { dispatchAction, getMutableState, getState } from '@etherealengine/hyperflux'
import { getMutableState, getState } from '@etherealengine/hyperflux'

import { CameraComponent } from '../../camera/components/CameraComponent'
import { FollowCameraComponent } from '../../camera/components/FollowCameraComponent'
import { V_000, V_010 } from '../../common/constants/MathConstants'
import { Engine } from '../../ecs/classes/Engine'
import { EngineActions } from '../../ecs/classes/EngineState'
import { Entity } from '../../ecs/classes/Entity'
import {
ComponentType,
Expand All @@ -47,10 +46,9 @@ import {
import { defineSystem } from '../../ecs/functions/SystemFunctions'
import { InputComponent } from '../../input/components/InputComponent'
import { InputSourceComponent } from '../../input/components/InputSourceComponent'
import { StandardGamepadButton, XRStandardGamepadButton } from '../../input/state/ButtonState'
import { StandardGamepadButton } from '../../input/state/ButtonState'
import { InputState } from '../../input/state/InputState'
import { ClientInputSystem } from '../../input/systems/ClientInputSystem'
import { InteractState } from '../../interaction/systems/InteractiveSystem'
import { Physics, RaycastArgs } from '../../physics/classes/Physics'
import { RigidBodyFixedTagComponent } from '../../physics/components/RigidBodyComponent'
import { CollisionGroups } from '../../physics/enums/CollisionGroups'
Expand Down Expand Up @@ -137,15 +135,6 @@ const onShiftLeft = () => {
controller.isWalking.set(!controller.isWalking.value)
}

const onInteract = (handedness: XRHandedness = 'none') => {
dispatchAction(
EngineActions.interactedWithObject({
targetEntity: getState(InteractState).available[0],
handedness
})
)
}

const onKeyP = () => {
getMutableState(RendererState).physicsDebug.set(!getMutableState(RendererState).physicsDebug.value)
}
Expand Down Expand Up @@ -245,21 +234,6 @@ const execute = () => {
}
}

/** @todo until we have something more sophisticated, allow interaction input even when interactables are captured */
for (const inputSourceEntity of inputSourceQuery()) {
const inputSource = getComponent(inputSourceEntity, InputSourceComponent)

const buttons = inputSource.buttons

const standardGamepad =
inputSource.source.gamepad?.mapping === 'standard' || inputSource.source.gamepad?.mapping === ''

if (buttons.KeyE?.down) onInteract()

if (standardGamepad && buttons[StandardGamepadButton.ButtonY]?.down) {
onInteract()
}
}
let inputEntities: Entity[] = nonCapturedInputSourceEntities
if (inputEntities.length === 0) {
inputEntities = inputSourceQuery().filter((entity) => {
Expand All @@ -274,12 +248,8 @@ const execute = () => {

const standardGamepad =
inputSource.source.gamepad?.mapping === 'standard' || inputSource.source.gamepad?.mapping === ''
const xrStandardGamepad = inputSource.source.gamepad?.mapping === 'xr-standard'

if (buttons.ShiftLeft?.down) onShiftLeft()
if (xrStandardGamepad) {
if (buttons[XRStandardGamepadButton.Trigger]?.down) onInteract(inputSource.source.handedness)
}

const gamepadJump = standardGamepad && buttons[StandardGamepadButton.ButtonA]?.down

Expand Down
8 changes: 1 addition & 7 deletions packages/engine/src/ecs/classes/EngineState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Ethereal Engine. All Rights Reserved.

import { defineAction, defineState } from '@etherealengine/hyperflux'

import { matches, matchesEntity, Validator } from '../../common/functions/MatchesUtils'
import { matches } from '../../common/functions/MatchesUtils'

// TODO: #6016 Refactor EngineState into multiple state objects: timer, scene, world, xr, etc.
export const EngineState = defineState({
Expand Down Expand Up @@ -75,12 +75,6 @@ export class EngineActions {
type: 'ee.engine.Engine.EXIT_SPECTATE' as const
})

static interactedWithObject = defineAction({
type: 'ee.engine.Engine.INTERACTED_WITH_OBJECT' as const,
targetEntity: matchesEntity.optional(),
handedness: matches.string as Validator<unknown, XRHandedness>
})

static notification = defineAction({
type: 'ee.engine.Engine.ERROR' as const,
text: matches.string,
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/src/input/InputModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Ethereal Engine. All Rights Reserved.
*/

import { FlyControlSystem } from '../avatar/systems/FlyControlSystem'
import { MotionCaptureInputSystem } from '../mocap/MotionCaptureInputSystem'
import { ButtonCleanupSystem } from './systems/ButtonCleanupSystem'
import { ClientInputSystem } from './systems/ClientInputSystem'

export { FlyControlSystem, ButtonCleanupSystem, ClientInputSystem }
export { FlyControlSystem, ButtonCleanupSystem, ClientInputSystem, MotionCaptureInputSystem }
17 changes: 2 additions & 15 deletions packages/engine/src/input/systems/ClientInputSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Ethereal Engine. All Rights Reserved.
import { useEffect } from 'react'
import { Mesh, MeshBasicMaterial, Quaternion, Ray, Raycaster, Vector3 } from 'three'

import { dispatchAction, getMutableState, getState, useHookstate } from '@etherealengine/hyperflux'
import { getMutableState, getState, useHookstate } from '@etherealengine/hyperflux'

import { CameraComponent } from '../../camera/components/CameraComponent'
import { ObjectDirection } from '../../common/constants/Axis3D'
import { Object3DUtils } from '../../common/functions/Object3DUtils'
import { isClient } from '../../common/functions/getEnvironment'
import { Engine } from '../../ecs/classes/Engine'
import { EngineActions, EngineState } from '../../ecs/classes/EngineState'
import { EngineState } from '../../ecs/classes/EngineState'
import { Entity, UndefinedEntity } from '../../ecs/classes/Entity'
import {
defineQuery,
Expand All @@ -48,7 +48,6 @@ import { createEntity, removeEntity } from '../../ecs/functions/EntityFunctions'
import { EntityTreeComponent } from '../../ecs/functions/EntityTree'
import { defineSystem } from '../../ecs/functions/SystemFunctions'
import { BoundingBoxComponent } from '../../interaction/components/BoundingBoxComponents'
import { InteractState } from '../../interaction/systems/InteractiveSystem'
import { Physics, RaycastArgs } from '../../physics/classes/Physics'
import { RigidBodyComponent } from '../../physics/components/RigidBodyComponent'
import { AllCollisionMask } from '../../physics/enums/CollisionGroups'
Expand Down Expand Up @@ -264,17 +263,6 @@ export const addClientInputListeners = () => {
}
document.addEventListener('touchstickmove', handleTouchDirectionalPad)

/** @deprecated */
const handleTouchGampadButton = () => {
dispatchAction(
EngineActions.interactedWithObject({
targetEntity: getState(InteractState).available[0],
handedness: 'none'
})
)
}
document.addEventListener('touchgamepadbuttondown', handleTouchGampadButton)

/**
* AR uses the `select` event as taps on the screen for mobile AR sessions
* This gets piped into the input system as a TouchInput.Touch
Expand Down Expand Up @@ -370,7 +358,6 @@ export const addClientInputListeners = () => {
canvas.removeEventListener('touchend', handleMouseClick)

document.removeEventListener('touchstickmove', handleTouchDirectionalPad)
document.removeEventListener('touchgamepadbuttondown', handleTouchGampadButton)

session?.removeEventListener('selectstart', onXRSelectStart)
session?.removeEventListener('selectend', onXRSelectEnd)
Expand Down
15 changes: 5 additions & 10 deletions packages/engine/src/interaction/systems/GrabbableSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { getAvatarBoneWorldPosition } from '../../avatar/functions/avatarFunctio
import { matches, matchesEntityUUID } from '../../common/functions/MatchesUtils'
import { isClient } from '../../common/functions/getEnvironment'
import { Engine } from '../../ecs/classes/Engine'
import { EngineActions, EngineState } from '../../ecs/classes/EngineState'
import { EngineState } from '../../ecs/classes/EngineState'
import { Entity } from '../../ecs/classes/Entity'
import {
defineQuery,
Expand All @@ -58,6 +58,7 @@ import {
import { SimulationSystemGroup } from '../../ecs/functions/EngineFunctions'
import { defineSystem } from '../../ecs/functions/SystemFunctions'
import { InputSourceComponent } from '../../input/components/InputSourceComponent'
import { XRStandardGamepadButton } from '../../input/state/ButtonState'
import { NetworkState } from '../../networking/NetworkState'
import { NetworkTopics } from '../../networking/classes/Network'
import { NetworkObjectAuthorityTag, NetworkObjectComponent } from '../../networking/components/NetworkObjectComponent'
Expand All @@ -71,7 +72,7 @@ import { TransformComponent } from '../../transform/components/TransformComponen
import { BoundingBoxComponent } from '../components/BoundingBoxComponents'
import { GrabbableComponent, GrabbedComponent, GrabberComponent } from '../components/GrabbableComponent'
import { createInteractUI } from '../functions/interactUI'
import { InteractableTransitions, addInteractableUI, removeInteractiveUI } from './InteractiveSystem'
import { InteractState, InteractableTransitions, addInteractableUI, removeInteractiveUI } from './InteractiveSystem'

export class GrabbableNetworkAction {
static setGrabbedObject = defineAction({
Expand Down Expand Up @@ -315,7 +316,6 @@ export const dropEntity = (grabberEntity: Entity): void => {
*/
export const grabbableInteractMessage = 'Grab'

const interactedActionQueue = defineActionQueue(EngineActions.interactedWithObject.matches)
const transferAuthorityOfObjectQueue = defineActionQueue(WorldNetworkAction.transferAuthorityOfObject.matches)

const grabberQuery = defineQuery([GrabberComponent])
Expand Down Expand Up @@ -347,13 +347,8 @@ const execute = () => {
const inputSource = getComponent(nonCapturedInputSource, InputSourceComponent)
if (inputSource.buttons.KeyU?.down) onDrop()
/** @todo currently mouse has to be over the grabbable for it to be grabbed */
// if (inputSource.buttons.KeyE?.down) onGrab(inputSource.assignedButtonEntity)
}

for (const action of interactedActionQueue()) {
if (action.targetEntity && hasComponent(action.targetEntity, GrabbableComponent)) {
onGrab(action.targetEntity, action.handedness === 'none' ? 'right' : action.handedness)
}
if (inputSource.buttons.KeyE?.down || inputSource.buttons[XRStandardGamepadButton.Trigger]?.down)
onGrab(getState(InteractState).available[0], inputSource.source.handedness)
}

for (const action of transferAuthorityOfObjectQueue()) transferAuthorityOfObjectReceptor(action)
Expand Down
Loading