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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Harry64 · Feb 05, 2013 at 02:31 AM · bugmathfsmoothdamp

Mathf.SmoothDamp's smoothTime faster at 0 than negative?

I have trouble with my FPS leaning function. When my camera was leaning to the side a collider with a rigidbody should detect collision.

but for some reason when I was leaning to the right side it looked like the collider detected the wall to late and I was looking through the wall. but when I was leaning to the left side it stops almost instantly.

after... now 2 or 3 hours I found out that it was not the collider but it was the SmoothDamp function that causes the problem. info: When the Collider hit a wall it tells the SmoothDamp that the target position is the current position.

after I unhided the smoothTime of the Mathf.SmoothDamp function in the script it was obvious.

When I lean to the right side the smoothTime is a positiv number and when the collider hits a wall it takes sometimes more than 1 second till the smoothTime is 0. When I lean to the left the smoothTime is a negative number and when I collide with a wall the smoothTime is instantly at 0.

I maybe find a work around but is this normal? or is this a Bug in Unity?

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 sparkzbarca · Feb 05, 2013 at 03:01 AM

smoothTime Approximately the time it will take to reach the target. A smaller value will reach the target faster.

so your number that is smaller than 0 which is the smallest amount of time it could take.

Is taking less time to reach the target than your other number which is greater.

A greater value taking more time.

Sounds like its working as intended

Comment
Add comment · Show 3 · 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 Harry64 · Feb 05, 2013 at 03:39 AM 0
Share

lol nice joke :). I thought the smallest value is 0. when I have a negative number to reach like in my case then the smoothTime is at the beginning like -1.253254 or so. and as closer you come to the target value so the smoothTime will be smaller. In my case the moment the collider hit something the current value and the target value are the same sooo it should also set the smoothTime to zero because it is already there where it should be! and I dont get it why it has still 0.00434 smoothTime for a second or so...

avatar image sparkzbarca · Feb 05, 2013 at 05:33 AM 0
Share

because you miss the target most likely. The odds that you are perfectly on target as you move are exceedingly unlikely.

At the end of the day your moving, and movement is really like a motion picture. Its a bunch of discrete movements done really fast. But those discrete movements are in fact basically teleporting. You teleport just a little past the target, and then it tries to correct.

What you need to do is something like

if vector3.distance(object.transform.position, target) < .001

smoothTime = 0;

or if (mathf.approximate(objet.transform.position, target) smoothTime = 0;

Allow a small leeway.

avatar image Harry64 · Feb 05, 2013 at 09:29 AM 0
Share

I did something like that already but this is still odd. it should not matter if you have a negative target or a positive target. I know that logically it could not go perfectly to the target and it will compensate. but I am already at the target. current = target in my case. so why still moving when its perfect there. with negative it works with positive not...

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

10 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

Related Questions

Mathf.SmoothDamp freeking out? 0 Answers

SmoothDamp keeps changing back 0 Answers

Time goes wrong in the Build 1 Answer

SmoothDamp from 360 to 1 1 Answer

Mathf.SmoothDamp happens instantly 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