- Home /
Question by
Dumad123 · Nov 07, 2013 at 07:21 PM ·
distancetiltpost effectsmousewheel
change tiltshift distance with mousewheel
Hey guys, So I want to make a feature in my game so that you can change the focus using the tiltshift post fx with the mouse wheel. Anyone have a script to do that? So like mousewheel up increases distance for tilt shift and mouse wheel down decreases distance. Thanks.
Comment
Tilt shift is an Image effect, so a more specific question would be do you want to increase the "focussed" area of the effect or the camera itself, because both would increase or decrease the distance.
var myTiltshiftScript = Camera.main.GetComponentInChildren<theTiltshifscriptattachedtocam>();
above will give you access to the tilt-shift script properties, replace what is in with the exact name of your tilt shift script
As for the distance:
target += Camera.main.transform.forward * scroll$$anonymous$$oveSpeed * Input.GetAxis("$$anonymous$$ouse ScrollWheel") * Time.deltaTime;
target is whatever transform you want it to move away or towards. 'target' here is a Vector3.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121422im_/https://answers.unity.com/themes/thub/images/avi.jpg)