Baseball Cap adding second and changing colour
Can someone help ive tried and tried to get the second cap to change colour to no avail. I have followed another post but I keep getting Error: Argument 0: Value is not a number at [anon] () native strict construct preventsyield at [anon] (Scripts/BaseballCapController:43) when changing the baseballcapcontroller under scrips and after duplicating the baseball cap controller (edit me) I get preventsyield group_start and group_end don't match clearly I am not clever enough to understand the problems and would love some assistance on how to do it from start to finish please. Regards
Hi Stickyshocker,
The hat was designed for only one face at a time so a lot of the variables and data controlling the customization options for the hat in Lens Studio expects there to be only one hat. While it is possible to duplicate all the necessary data it will require some time to put together an example regarding how to do it on your end. I wanted to reach out to you and let you know that we're actively investigating a solution.
Best
Doug
Hi Doug
Thanks for the reply.
I have followed steps and got a second cap working and able to change the brim curve but i am unable to change the colour of the second hat. If i change the properties for the second it changes both. Also when asking the software to change colour when opening mouth etc it throws up an error report.
Any idea?
Ok. So. Here we are. To create two hats that operate independently you have to duplicate almost everything. I mean almost everything haha. So let's go through this step by step.
First. Find the script BaseballCapController.js. Open it in an editor of your choice and find the line at 30. You'll need to change this default value to false. This will expose the input for BaseballCapProperties.js in the inspector tab.
Change it to false
You should see this exposed at the bottom now of the BaseballCapController script object.
Next, duplicate all of the materials associated with the hat. I like to leave the numbers added to the end when duplicating to make it easier to associate everything.
Now we have to duplicate everything related to the hat and face as we've done here
On Head 2 you find a duplicate of the HatTransform. We'll need to go into every mesh visual and apply the duplicate materials to each object so that they can be controlled separately. If for some reason by the end of this your second script isn't controlling the second hat then this is most likely the issue.
For every instance of a second object select all of them and set their Face Index value to 1. This will associate it with a second face when found.
On your duplicate copy of BaseballCapProperties you'll need to link all of the duplicated objects to control the second hat. You can see here we've linked the second version of the materials. For the blend shapes it looks like they all have the same names but these are the duplicate versions coming from the second Head object. So make sure you link the correct ones to this second instance of BaseballCapProperties.
It should look like this.
You can copy the exact same names for the Blendshape Names values as they will be the same. Just copy and paste the names from the first instance of BaseballCapProperties.
Finally, on your second copy of BaseballCapController you need to link the second version of BaseballCapProperties at the bottom. This will allow this second version of BaseballCapController to manipulate all the values associated with it.
I know this is a lot of setup so let me know if you have any issues.
Best
Doug
Thanks man! Sorry missed you had replied. I will try when I get home later! Regards