Coding error

Options
Caleb Cook
Caleb Cook Posts: 1
edited August 2022 in General #1

I was following this tutorial https://www.youtube.com/watch?v=2MV5IUsXOQY
And then I got this error message [Scenarium] TypeError: undefined not callable (property 'gettransform' of [object Object])
at [anon] (Script.js:9) preventsyield
And also
Hear is the code

// -----JS CODE-----
// @input Component.RenderMeshVisual facemesh
// @input SceneObject target
// @input

var rotmin = 127.2994;
var rotmax = 142.9906;

var Weight
=script.facemesh.mesh.control.getExpressionWeightByName(Expressions.JawOpen);
print(Weight);

var Rotationdegrees = (rotmax - rotmin) * Weight + rotmin;
var Rotationradians = (Rotationdegrees * Math.PI) / 180;

var originalrot = script.target.gettransform().getLocalRotation().toEulerAngles();

The part where it says var weight =script.facemesh.mesh.control.getExpressionWeightByName(Expressions.JawOpen);
And print(Weight);

Is where the error occurred

Answers

  • 100%spam
    Options

    The third input may be throwing errors since it is empty. The tutorial also addresses this problem: "To access the face expressions, we need to access mesh.control on the face mesh and then grab the weight of the expression we want. The weights range from 0-1 and a full list of the expressions Lens Studio supports can be found here. In my case I want to access the JawOpen weight to control the jaw bone on my skull model. I'm also going to print out the weight to check and make sure it is working. Once you add the following code and save the script, you might notice an error in the Logger. That is because we are missing the script inputs. Select the script in the Objects Panel and choose the face mesh and your target object for the input parameters. Also change "On Awake" to "Frame Updated" for when the script should run. "

  • Bakari Mustafa
    Bakari Mustafa Posts: 178 🔥🔥🔥
    Options

    To fix this error, you need to make sure that the "facemesh" object is properly set up and connected to the correct component in your scene.

    Here are some steps you can try:

    1. Make sure that you have a "Render Mesh Visual" component attached to an object in your scene, and that it is correctly connected to the "facemesh" input of your script.
    2. If the "facemesh" object is still not defined, try restarting Lens Studio and reopening your project.
    3. If the problem persists, try checking for any typos or errors in your code. Make sure that you have spelled everything correctly and that all of your brackets and semicolons are in the correct place.