Hello, I couldn’t find thread where is solved my problem. So, let we start.
The problem is with function that will change in game camera distance from target.
[
void changeDistance(){
float distance = 2.0f;
//bool isMouseScrollActive = Input.GetAxis("Mouse ScrollWheel") !=0 ; // if mouse scrool is active return value true/false
//bool isMouseScrollActive = EventType.ScrollWheel; // does not work as I want.
//Event isMouseScrollActive = Event.current; // does not work.
if (isMouseScrollActive == true) {
do{
print ("Roll Forward");
distance++;
print (distance);
}while (Input.GetAxis("Mouse ScrollWheel") > 0);
do{
print ("Roll Back");
distance--;
print (distance);
}while (Input.GetAxis("Mouse ScrollWheel") < 0);
}
}
](http://pastebin.pl/view/bb99686f)
I don’t areally known C# and I got problem like
Also now I don’t know areally how to fix it.
What I want from my script is to change distance only when Scroll is areally used.
It should work in 3d space. I’m thinking about Vector Maths.
Which one is good to choose for the distance betwen myTarget and myTargetCamera ?