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 haider1515 · Dec 21, 2011 at 11:10 AM · positionscalescaling

Unity Scaling an object from scripts

my script is this...When i scale the object it transform.position gets the same but in the world it shows at different position.

using UnityEngine; using System.Collections;

public class size1 : MonoBehaviour {

 // Update is called once per frame

 void Update() {
     
 
     
         
     
     
     if(abc.Ball1>900 && abc.Ball1<=1000)
     {
         
         transform.localScale=new Vector3(1.5f,1.5f,1.5f);
     }
     else if(abc.Ball1>800 && abc.Ball1<=900)
     {        
         transform.localScale=new Vector3(1.3f,1.3f,1.3f);
     }
     else if(abc.Ball1>700 && abc.Ball1<=800)
     {        
         transform.localScale= new Vector3(1.1f,1.1f,1.1f);
     }
     else if(abc.Ball1>600 && abc.Ball1<=700)
     {        
         transform.localScale= new Vector3(.9f,.9f,.9f);
     }
     else if(abc.Ball1>500 && abc.Ball1<=600)
     {        
         transform.localScale=new Vector3(.7f,.7f,.7f);
     }
     else if(abc.Ball1>400 && abc.Ball1<=500)
     {        
         transform.localScale=new Vector3(.5f,.5f,.5f);
     }
     else if(abc.Ball1>300 && abc.Ball1<=400)
     {        
         transform.localScale=new Vector3(.4f,.4f,.4f);
     }
     else if(abc.Ball1>200 && abc.Ball1<=300)
     {        
         transform.localScale= new Vector3(.3f,.3f,.3f);
     }
     else if(abc.Ball1>150 && abc.Ball1<=200)
     {        
         transform.localScale= new Vector3(.2f,.2f,.2f);
     }
     else if(abc.Ball1>=50 && abc.Ball1<=150)
     {        
         transform.localScale=new Vector3(.1f,.1f,.1f);
     }
     else if(abc.Ball1>0 && abc.Ball1<50)
     {        
         transform.localScale= new Vector3(0f,0f,0f);
     }
 
 }

}

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 flamy · Dec 21, 2011 at 11:23 AM 0
Share

probably it is with the pivot point of the gameObject u r using?!

check where the pivot point is !!

avatar image haider1515 · Dec 21, 2011 at 12:02 PM 0
Share

pivot cannot be changed in unity

avatar image haider1515 · Dec 21, 2011 at 12:03 PM 0
Share

i have hacked its pivot from gameobject it give the same result

avatar image HHameline · Dec 21, 2011 at 01:11 PM 0
Share

If you rotate the object around it's Y after you scale it you'll see where the pivot actually is.

1 Reply

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

Answer by Bunny83 · Dec 21, 2011 at 05:26 PM

The scaling happens always around the objects pivot point. The position is not affected when you change the scale. That sounds like you have set the pivot mode to "center" instead of pivot:

pivot mode image

If the mode is set to "center" it shows the "handle" at the objects center instead of its pivot

You are right, you can't set the pivot point in Unity, but in the application you created the object. I'm not an artist so i can't advise you how ;)

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 haider1515 · Dec 22, 2011 at 08:07 AM 1
Share

i changed the pivot in maya and import it back...thanx

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

7 People are following this question.

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

Related Questions

Scaling and performance? 0 Answers

A node in a childnode? 1 Answer

How do you move an object relative to a plane's global scale? 3 Answers

Set plane scaling pivot point? 1 Answer

Particle Scaling for Particle-UI-Elements 0 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