Mouth tracking script

I discover that is possible to use upper lips as a point to track the face. I found this script but its not updated to the promise stuff.

90136800_521935405172600_8593051131939127296_n

Someone could help me make it work with the new scripting stuff ?


I need to use the upper lips center point as a tracking point.

It’s really simple to convert, just use an async/await in the findfindFirst method. If you share a gist I can do it for you

// How to load in modules
const Scene = require(‘Scene’);
const FaceTracking = require(‘FaceTracking’);

Promise.all([

Scene.root.findFrist(‘object00’),

]).then(function(results){

const plane = results[0]

})

// locate the object in the Scene
const wheat = Scene.root.find(‘object00’);

// Store a refece to detected face
const face = FaceTracking.face(0);

const whatTransform = wheat.transform;

const upperLipCenter = face.mouth.upperLipCenter;

wheatTransform.x = upperLipCenter.x;
wheatTransform.y = upperLipCenter.y;
wheatTransform.z = upperLipCenter.z;

wheatTransform.rotationX = upperLipCenter.x;
wheatTransform.rotationY = upperLipCenter.y;
wheatTransform.rotationZ = upperLipCenter.z;

This should work https://gist.github.com/tomaspietravallo/fb3c8b05886d4f2fd73b8a947ad085e2

1 Like

I got the message “Possible Unhandled Promise Rejection: TypeError: undefined is not a function”

Updated, I had made a typo on line 5

1 Like

It worked now thank you very much! :smiley:

1 Like