How to tap to change settings in a script
I'm using the Baseball Cap template
The template includes a script that allows you to change hat's tilt/curve/swivel with a sliders that go from -1 to 1.
I would like the lens user to use a screen image to tap through 3 values of the different properties.
So maybe one image is for the hat's Tilt and each time you tap it the tilt changes by 1
So maybe the tilt start at 0 when the lens is turned on. You tap the "tilt" button once and the hat's tilt goes to 1. Tap it again and it goes to -1. Tap it again and it goes to 0. Tap it again and it goes to 1....so on
Is this possible?
Hey loupis1,
This effect can be done with a simple script added to the Baseball Cap template.
We'll first expose create an api function adjusting the tiltHat variable in BaseballCapController script. We can do so by adding this to the script:
To learn more about scripting and api reference, check out this Scripting Overview page!
This basically copies from the existing script (line 166-174), and replace script.hatTilt with a custom _number value that we're gonna assign with our TapToChange script.
Then we'll create a TapToChange script:
And then attach TapToChange to any object in the scene, and in Inspector link the BaseballCapController object to it.
Then you have it! The hatTilt value is printed from the TapToChange script, feel free to change it to your liking!
Best of luck!
Nico