• 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 youngapprentice · Aug 15, 2015 at 05:45 PM · camerarotationmouselookorbit

Mathf.Clamp is 'Sticky'?

I have a camera parented to a pivot object that I control to rotate around it.

I've Mathf.Clmaped the values and it works well, but if I go to an extremity and get clamped and then attempt to change direction, there is a huge delay before the camera begins to rotate, making its boundaries feel 'sticky'

Any help is appreciated. Thanks! - YA

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
1

Answer by Owen-Reynolds · Aug 15, 2015 at 06:19 PM

No. Clamp is a 1-time thing, and isn't the tiniest bit "sticky." For example: in int x=Mathf.Clamp(x,1,10); x=x+y; the second adding line y doesn't know or care about the clamp, and will gladly take x out of the 1-10 range.

Clamp is merely: if(x<min) x=min; else if(x>max) x=max;. It doesn't do anything more than that.

When it seems like a 1-time operation is continually affecting an object, sometimes it's because you're accidentally running the line for many more frames than you intended. But it's never because you "queued-up" that line a few frames ago (unless you put it in a coroutine.)

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

26 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

Related Questions

Camera position not updating 1 Answer

Mouse Orbit snapping issues 0 Answers

Rotate an object around another on input 0 Answers

Reposition camera behind the player character during movement 1 Answer

How to Rotate camera around object SMOOTHLY when using Input.GetKeyDown 1 Answer

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