• 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 obergon · May 14, 2013 at 08:59 AM · spherelocalscale

Scaled sphere moving very strangely!

My game involves spheres that double in size under certain conditions. I increase the size over time using a coroutine that lerps localScale over a given period of time. This part works fine. =)

The spheres are moved around by trigger zones - ie. I AddForce() in OnTriggerStay()

HOWEVER, after being scaled up like this, these spheres don't move correctly - they will suddenly change direction for no apparent reason. =(

My code is so simple - am I missing something obvious here?

Thanks in advance!

Comment
Add comment · Show 7
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 Fattie · May 14, 2013 at 08:59 AM 0
Share

can you explain if you are using colliders, and how

avatar image Mexallon · May 14, 2013 at 09:21 AM 0
Share

Sounds to me like you using the wrong Space (world, local) in the part where you define the direction of the sphere.

avatar image obergon · May 14, 2013 at 09:27 AM 0
Share

I don't think it's a Space issue - the sphere will move correctly for a while and then (sometimes) change direction... unless I'm missing something - please elaborate if you think I am...

avatar image obergon · May 14, 2013 at 09:29 AM 0
Share

Colliders: the spheres are moved by a trigger collider (AddForce in OnTriggerStay) and have their own standard colliders for bumping into other objects. Pretty straightforward really. All works perfectly until the spheres are scaled up.....

avatar image robertbu · May 14, 2013 at 08:38 PM 1
Share

Are you absolutely certain you are not hitting some collider? Are you adding force while the sphere is moving, and if so, is the angular velocity changing? You have no code other than forces that might be impacting your spheres, no code that is modifying the Transform? Lots of posts question if their problem is a Unity bug. Ninity-nine percent of the time it is a programmer bug (or at least something the programmer did not understand). Posting your code here might help someone spot a problem.

Show more comments

1 Reply

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

Answer by raimon.massanet · May 14, 2013 at 11:14 AM

You don't need to change the radius of the sphere collider, since it will "automagically" be scaled when the sphere object is scaled. If you DO change the radius of the sphere collider, then you are having a collider which is bigger than expected and is probably causing unexpected triggers, which in turn are causing the unexpected behavior. You can check all this out from the scene view, where you will see the size of the collider at play time.

Comment
Add comment · Show 2 · 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 Fattie · May 14, 2013 at 11:20 AM 0
Share

indeed, You can check all this out from the scene view, where you will see the size of the collider at play time

it's that simple

avatar image obergon · May 14, 2013 at 08:21 PM 0
Share

I am not changing the radius if the collider! As you say it just gets scaled with everything else. The sphere moves correctly in the right direction at the right speed, then sometimes suddenly changes direction for no apparent reason! The collision is not a part of this weird behaviour....

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

I generated many spheres and unity is so slow and laggy. What should I do? 2 Answers

Sphere following player with right physics 0 Answers

Using WASD keys instead of mouse to roll ball? 1 Answer

Inserting a 3d object inside an other 0 Answers

Car driving in a spherical world. 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