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

Consider isBinary in weight for override amounts #1485

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
15 changes: 9 additions & 6 deletions packages/three-vrm-core/src/expressions/VRMExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export class VRMExpression extends THREE.Object3D {
*/
public get overrideBlinkAmount(): number {
if (this.overrideBlink === 'block') {
return 0.0 < this.weight ? 1.0 : 0.0;
const actualWeight = this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
return 0.0 < actualWeight ? 1.0 : 0.0;
} else if (this.overrideBlink === 'blend') {
return this.weight;
return this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
} else {
return 0.0;
}
Expand All @@ -60,9 +61,10 @@ export class VRMExpression extends THREE.Object3D {
*/
public get overrideLookAtAmount(): number {
if (this.overrideLookAt === 'block') {
return 0.0 < this.weight ? 1.0 : 0.0;
const actualWeight = this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
return 0.0 < actualWeight ? 1.0 : 0.0;
} else if (this.overrideLookAt === 'blend') {
return this.weight;
return this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
} else {
return 0.0;
}
Expand All @@ -74,9 +76,10 @@ export class VRMExpression extends THREE.Object3D {
*/
public get overrideMouthAmount(): number {
if (this.overrideMouth === 'block') {
return 0.0 < this.weight ? 1.0 : 0.0;
const actualWeight = this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
return 0.0 < actualWeight ? 1.0 : 0.0;
} else if (this.overrideMouth === 'blend') {
return this.weight;
return this.isBinary ? (this.weight <= 0.5 ? 0.0 : 1.0) : this.weight;
} else {
return 0.0;
}
Expand Down