Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by gamedevsmith · Jan 07, 2013 at 08:45 AM · rotationfpsnoobcustom

Urgent! Rotation question!

Hello, I am a new solo developer using unity. I am trying to make it so that my character cannot twist around 360 degrees. I want it so that the character can only look 180 degrees (from left to right). Here is a run-down of what I have done with my character:

-Added the mouse look script to all the parts of the character I want to move. The specifics I have put in all of them are:

min x: -10

max x: 10

min y: -10

max y: 10

-Taken all the first person controller scripts and added them to my character model

-Taken the main camera from the first person controller and added it to my caharacter model

-Positioned the main camera in the characters head, as if it were eyes.

Please help!!! Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by koichisenada · Jan 07, 2013 at 09:07 AM

I suppose you're turning your character by the mentioned "mouse look script", so that is the script you should tweak to introduce the rotation borders.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gamedevsmith · Jan 07, 2013 at 09:57 AM 0
Share

I tried that, but the character just spins 360 anyway? Ideas?

avatar image koichisenada · Jan 07, 2013 at 11:13 AM 0
Share

It depends on the way you're tweaking your script. Suppose, your code detects that current angle is 178 degrees and your mouse input offers additional 4 degrees, but before applying it your code would check the result and find that 182 degrees are more than the boundary limit of 180 degrees, so it just puts the value of 180 degrees.

float angle = this.GetCurrentAngle();

float angleNew = angle + this.GetAdditionalAngle();

if (angleNew>180) { angle = 180; } else { angle = angleNew; }

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

why is the mouse look messing up on the new fps character 0 Answers

Heya again guys how about rotation and score board 0 Answers

Making a continuous shooting sound while the fire button is held down. 1 Answer

Can't stop camera from rotating on Z Axis 1 Answer

How can I make player rotation control camera's x rotation and mouse control it's y rotation? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges