How To Stop The Spinning Camera In Vrchat
- Spaces
- Default
- Help Room
- META
- Moderators
-
- Topics
- Questions
- Users
- Badges
- Domicile /
0
How to fix a camera rotating non-stop for my 3rd person view.,How to stop my camera from slowly rotating afterward input.
I utilise clamp angles to limit my rotation on my y and stop them on both y and z but it wont stop spinning unless I slowly tap in the contrary direction and luckily use the same counterforce otherwise information technology just keeps spinning without end. https://m.youtube.com/watch?5=LbDQHv9z-F0&t=329s This is the tutorial that I followed which happens to requite the best setup. All other tutorials use clamp and requite the same bug so I can't get a set up. I'k completely hopeless when it comes to coding then if u code tell me where the prob is and how to fix in not-technical terms that would be greatly appreciated.
2 Replies
· Add your answer
- Sort:
0
Answer by Magso · Dec 01, 2019 at 06:02 PM
I'm guessing the camera is rotating by a value that's controlled by pressing left and right and this value needs to be returned to zero. You could have an else
after the if input statements to set the value to nil. Alternatively rotate the camera directly when inputs are pressed using GetKey.
The camera is controlled by mouse with Input.GetAxis("$$bearding$$ouse X")
and ("$$anonymous$$ouse Y")
. Well, at least that's how it'due south done in the tutorial at the link.
"slowly tap in the reverse direction" is what fabricated me assume it's controlled by keys. Still same affair could apply with GetAxis if @XGurem has lawmaking similar value += Input.GetAxis("$$anonymous$$ouse X")
Good indicate. But either way, GetAxis
is designed to return values from 0 to 1 or 0 to -one, and it returns 0 if the user doesn't hold any of the keys (or when he holds both positive key and negative fundamental together). So, you don't need to set values to 0 in the code, it's already 0 when the user releases the primal, and value += Input(GetAxis("Anything")
is equal to previous value
if the user haven't held the key in Annihilation
centrality since the previous frame.
Show more comments
0
Answer by XGurem · Dec 03, 2019 at 02:09 AM
I merely changed input.getaxis("mouse x/y") input to input.getaxis("CamHor/Vert") that I made in input settings. I would love to use getkey but I'm non sure how to exercise information technology with quaternions and I couldn't find a tutorial or unity lesson on that. @Magso
Hither we are! Some useful data finally. Seems similar you haven't gear up your "Cam Hor/Vert" properly. First guess: you lot haven't prepare gravity for axes. This setting makes axes inputs to become to 0 when assotiated buttons are not holded. With gravity set to 0 your "Cam Hor" volition always return i if you lot accept pressed the button at to the lowest degree once, and it doesn't become to 0.
Get$$bearding$$ey returns a bool and you lot need to rotate using a bladder or int so you'd demand a ?: operator.
//is Input.Go$$bearding$$ey("cardinal") true? Aye return 1, no return 0. floatFromBool = Input.Go$$anonymous$$ey("fundamental") ? 1f : 0f; //and rotate. transform.rotate(new Vector3(0, floatFromBool, 0));
Your answer
Welcome to Unity Answers
The best place to inquire and reply questions about development with Unity.
To assistance users navigate the site nosotros accept posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for normally asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
Nosotros are making improvements to UA, come across the list of changes.
Follow this Question
Related Questions
Source: https://answers.unity.com/questions/1680891/how-to-fix-a-camera-rotating-non-stop-for-my-3rd-p.html
Posted by: huberdoperelpland.blogspot.com
Evidence the lawmaking. Nosotros're not telepaths.
That snarky comment made me laugh. Thnx bro u made my day. Due to reasons I'grand currently unable to. Just change mouse y/x to cam Hor/vert. I use keyboard.
Well, since you haven't provided anything that could be useful in guild to help you, I've asked to just evidence your code so I would detect out what take you inverse at that place and where the source of the problem could be.