Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Catlard · Jun 02, 2011 at 06:23 PM · vector3lerpshrinking

Shrinking an object to Vector3.zero

Hey, folks! Thanks for your help.

I've been playing around with Vector3.Lerp, but I don't understand why what I'm trying isn't working. Basically, I've got a cube whose scale is (1,1,.1), and the code I've got here isn't working. Any advice or code examples? Thanks a bunch!

 if(shrink)
 {
     if (t < 1.0) 
     {
         t += shrinkspeed;
         transform.localScale = Vector3.Lerp(Vector3.zero,startingScale, t);
     }
 }
Comment
Add comment · Show 1
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 Owen-Reynolds · Jun 02, 2011 at 11:30 PM 0
Share

Nice if you could say what if was doing during the "not working" phase. The most common problem, for javascript, is not declaring t as a float (so adding 0.01 just rounds back to 0.) Set t public to see it in the inspector. If that was the problem, the model would always be size 0.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by testure · Jun 02, 2011 at 07:48 PM

personally I just use iTween for this sort of thing. iTween.ScaleTo(gameObject, Vector3.zero, time);

done like dinner.

Comment
Add comment · Show 1 · 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 Catlard · Jun 03, 2011 at 01:04 AM 0
Share

Dinner! I like dinner.

avatar image
2

Answer by flaviusxvii · Jun 02, 2011 at 06:29 PM

What you have will lerp the scale from Vector3.zero to startingScale.. as t moves from 0.0 to 1.0.

http://unity3d.com/support/documentation/ScriptReference/Vector3.Lerp.html

Comment
Add comment · Show 1 · 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 Catlard · Jun 02, 2011 at 06:32 PM 0
Share

hmmmm...I agree. let me try switching that around...

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Using Lerp in a Constant Moving Object 1 Answer

Not Sure How to Get Around this Problem 1 Answer

Object movement with smooth start and end? 2 Answers

Do something when lerp reached target. 1 Answer

Vector3.Lerp making my object invisible. 2 Answers


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