Eyes not independently blinking
I'm not able to get the eyes to move independently.
I followed the example here and added left and right eyes. But when I squint one eye, the other eye closes as well in the Lens.
I've confirmed that "left" and "right" eye trackers are on opposite sides of the face.
Any ideas? Thanks!
Here's the script:
// -----JS CODE-----
// @input SceneObject topLipTracker
// @input SceneObject bottomLipTracker
// @input SceneObject topLeftEyelidTracker
// @input SceneObject bottomLeftEyelidTracker
// @input SceneObject topRightEyelidTracker
// @input SceneObject bottomRightEyelidTracker
// @input Component.BlendShapes blendShape
// @input string mouthBlendShapeName
// @input string lEyeBlinkBlendShapeName
// @input string rEyeBlinkBlendShapeName
function onUpdateEvent( eventData )
{
setBlendShape(script.mouthBlendShapeName, script.topLipTracker, script.bottomLipTracker, 3.7, 2);
setBlendShape(script.lEyeBlinkBlendShapeName, script.topLeftEyelidTracker, script.bottomLeftEyelidTracker, 1, 1.8);
setBlendShape(script.rEyeBlinkBlendShapeName, script.topRightEyelidTracker, script.bottomRightEyelidTracker, 1, 1.8);
}
function setBlendShape(blendShapeName, topTracker, bottomTracker, openValue, closeValue)
{
var dist = getDistance( topTracker, bottomTracker );
var ratio = ( dist - closeValue ) / ( openValue - closeValue );
ratio = Math.max( 0, Math.min ( ratio, 1.0 ) );
script.blendShape.setBlendShape(blendShapeName,ratio);
}
function getDistance( pointA, pointB )
{
return pointA.getTransform().getWorldPosition().distance( pointB.getTransform().getWorldPosition() );
}
var updateEvent = script.createEvent( "UpdateEvent" );
updateEvent.bind( onUpdateEvent );
Hey Dan,
Can you please share your project file so I can take a look at?
Cheers,
Amir.