this is something i should be abule to work out on my own but its been a while since i have tried any scripting
i am using this script and i am trying to work out a way to make the camera rotate only when the right or left mouse button is held. any help would be appreciated ![]()
Your question here is nothing to do with camera rotation.
To detect a mouse click, you can use
if (Input.GetButton (“Fire1”)) {
//only execute this code if Fire1 is pressed, which is mapped to left mouse by default
}
Find the part of the code that does the rotation and wrap it with something like the above.
Maybe somebody will modify that script to do what you want, but in my opinion you should try to use this code and check out some scripting tutorials otherwise you’re going to find yourself resorting to the forum for every single issue you come across in the future.
You can find some info and short examples of detecting key and mouse presses at the official docs here: Unity - Scripting API: Input
im not looking for someone to do it for me just some tips how to do it.
i am trying to relearn the java i had worked out in the past and build on top of that
thanks for the tip
Find all the code stuff which makes the camera rotate…
And put it between : if (Input.GetButton (“Fire1”)) {
and : }
So it is only executed when you hold the left click.
As explicitly suggested by xomg.
I’ve tried this, I don’t know if I’m picking the wrong bit of code or anything, but I always get an error saying "expecting (, lateUpdate) (late update refers to the function i wrapped the if function around)
basically, it doesn’t work ![]()
would it work if I did it around the entire script?