fix: tilt Memento shy state left
This commit is contained in:
parent
271a0dfa2f
commit
89083bd0a1
@ -320,6 +320,7 @@ const fixedSkinColorBehavior = (behavior?: AvatarBehaviorLibrary): AvatarBehavio
|
||||
|
||||
const mementoHeadsetWorkingExpressionId = 'memento-headset-working-joyful-eyes'
|
||||
const mementoHeadsetShyExpressionId = 'memento-headset-shy-left'
|
||||
const mementoHeadsetShyTiltExpressionId = 'memento-headset-shy-left-tilt'
|
||||
|
||||
const copyExpressionEyes = (target: Expression, source: Expression): Expression => ({
|
||||
...target,
|
||||
@ -348,7 +349,8 @@ const mementoBehavior = (
|
||||
expression.semanticKey !== 'onboarding-listening' &&
|
||||
expression.semanticKey !== 'onboarding-curious' &&
|
||||
expression.semanticKey !== mementoHeadsetWorkingExpressionId &&
|
||||
expression.semanticKey !== mementoHeadsetShyExpressionId
|
||||
expression.semanticKey !== mementoHeadsetShyExpressionId &&
|
||||
expression.semanticKey !== mementoHeadsetShyTiltExpressionId
|
||||
)
|
||||
const expressions = sourceExpressions.map(expression => {
|
||||
const fixedColorExpression = { ...expression }
|
||||
@ -415,12 +417,34 @@ const mementoBehavior = (
|
||||
positionYRight: shySource.positionYRight + 10,
|
||||
}
|
||||
: undefined
|
||||
const shyTiltSource = expressions.find(expression => expression.semanticKey === 'shy-downward')
|
||||
const headsetShyTiltExpression =
|
||||
customizeHeadsetExpressions && shyTiltSource
|
||||
? {
|
||||
...shyTiltSource,
|
||||
id: mementoHeadsetShyTiltExpressionId,
|
||||
semanticKey: mementoHeadsetShyTiltExpressionId,
|
||||
headZ: -Math.abs(shyTiltSource.headZ),
|
||||
}
|
||||
: undefined
|
||||
const sequenceFirstExpression = new Map<string, string>([
|
||||
...(headsetWorkingExpression ? [['working', headsetWorkingExpression.id] as const] : []),
|
||||
...(headsetShyExpression ? [['shy', headsetShyExpression.id] as const] : []),
|
||||
])
|
||||
const resolvedSequences = sequences.map(sequence => {
|
||||
const expressionId = sequenceFirstExpression.get(sequence.semanticKey ?? '')
|
||||
if (sequence.semanticKey === 'shy' && headsetShyTiltExpression) {
|
||||
return {
|
||||
...sequence,
|
||||
steps: sequence.steps.map((step, index) =>
|
||||
index === 0 && expressionId
|
||||
? { ...step, expressionId }
|
||||
: index === 1
|
||||
? { ...step, expressionId: headsetShyTiltExpression.id }
|
||||
: step
|
||||
),
|
||||
}
|
||||
}
|
||||
return expressionId
|
||||
? {
|
||||
...sequence,
|
||||
@ -435,6 +459,7 @@ const mementoBehavior = (
|
||||
...expressions,
|
||||
...(headsetWorkingExpression ? [headsetWorkingExpression] : []),
|
||||
...(headsetShyExpression ? [headsetShyExpression] : []),
|
||||
...(headsetShyTiltExpression ? [headsetShyTiltExpression] : []),
|
||||
...onboardingExpressions,
|
||||
],
|
||||
sequences: [
|
||||
|
||||
@ -230,6 +230,9 @@ describe('Studio document', () => {
|
||||
const headsetShyFirst = headsetMemento?.behavior?.sequences.find(
|
||||
sequence => sequence.semanticKey === 'shy'
|
||||
)?.steps[0]
|
||||
const headsetShySecond = headsetMemento?.behavior?.sequences.find(
|
||||
sequence => sequence.semanticKey === 'shy'
|
||||
)?.steps[1]
|
||||
const headsetWorkingExpression = headsetMemento?.behavior?.expressions.find(
|
||||
expression => expression.id === headsetWorkingFirst?.expressionId
|
||||
)
|
||||
@ -239,6 +242,9 @@ describe('Studio document', () => {
|
||||
const headsetShyExpression = headsetMemento?.behavior?.expressions.find(
|
||||
expression => expression.id === headsetShyFirst?.expressionId
|
||||
)
|
||||
const headsetShyTiltExpression = headsetMemento?.behavior?.expressions.find(
|
||||
expression => expression.id === headsetShySecond?.expressionId
|
||||
)
|
||||
expect(headsetWorkingExpression).toMatchObject({
|
||||
widthLeft: headsetJoyfulExpression?.widthLeft,
|
||||
widthRight: headsetJoyfulExpression?.widthRight,
|
||||
@ -260,6 +266,11 @@ describe('Studio document', () => {
|
||||
positionYLeft: initialExpressions[0].positionYLeft + 10,
|
||||
positionYRight: initialExpressions[0].positionYRight + 10,
|
||||
})
|
||||
expect(headsetShyTiltExpression).toMatchObject({
|
||||
headX: initialExpressions[24].headX,
|
||||
headY: initialExpressions[24].headY,
|
||||
headZ: -Math.abs(initialExpressions[24].headZ),
|
||||
})
|
||||
expect(
|
||||
memento?.behavior?.sequences.find(sequence => sequence.semanticKey === 'joyful')?.steps[0]
|
||||
.expressionId
|
||||
|
||||
Loading…
Reference in New Issue
Block a user