• 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
2
Question by Sylon87 · Feb 08, 2019 at 05:04 AM · rotationscript.rotating

Get only -180 to 180 value

hello!

i'm looking for a way to get back only the value from -180 to 180 on my rotate object, because up -180 it will go to -181 and so on...

thank's you in advance

Comment
Add comment · Show 4
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 sean244 · Feb 08, 2019 at 03:50 AM 0
Share

I think you're looking for the $$anonymous$$athf.Clamp function, but if you post your code, I can better help you.

avatar image Sylon87 sean244 · Feb 08, 2019 at 03:53 AM 0
Share

is this, works well until player angle will go out of -180

         _temporanyValue[id] = _playerAngle[id];
 
         
         if(_temporanyValue[id] >= 0)
         {
             _target[id] = _temporanyValue[id] / 360;
             float FixedY = $$anonymous$$athf.Lerp(12f,15f,_target[id]);
             
             Vector3 fixedPos = new Vector3(_iconObject[id].transform.position.x,FixedY,_iconObject[id].transform.position.z);
             _iconObject[id].transform.position = fixedPos;
         }
         else
         {
             _target[id] = (360 + _temporanyValue[id]) / 360;
             float FixedY = $$anonymous$$athf.Lerp(15f,12f,_target[id]);
             Vector3 fixedPos = new Vector3(_iconObject[id].transform.position.x,FixedY,_iconObject[id].transform.position.z);
             _iconObject[id].transform.position = fixedPos;        
         }
avatar image sean244 Sylon87 · Feb 08, 2019 at 03:56 AM 0
Share

That code is very cryptic. Can you better explain what exactly it is your trying to achieve? $$anonymous$$aybe provide an image or a video?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Sylon87 · Feb 08, 2019 at 09:16 AM

no one can help me?

Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have 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 commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

143 People are following this question.

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

Related Questions

Player making a 360° looping, camera not following 0 Answers

Rotate within range 1 Answer

Pivoting camera 1 Answer

Weird Output from AngleAxis 0 Answers

managing rotation of Turret on two axis 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges