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
1
Question by FourSheds · Sep 22, 2011 at 09:21 AM · physicssphereballfrictionroll

Strange sphere/physics rolling behaviour when scaled

Hi I have a sphere (imported model) rolling along a flat surface. It's controlled by the arrow keys via AddForce(). It works very well, and the physics engine and friction take care of it rolling (rather than sliding) realistically. I can import the ball at any size and it works consistently, however if I manually scale the ball's transform instead, by half (.5,.5,.5), or less, it moves very jerkily. I've tried adjusting the friction settings, in case the engine uses scale for it's friction calculation, but to no avail.

At various points in the game I need this ball to be continuously scaleable. Is there another way to approach this problem?

Thanks

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
Best Answer

Answer by Tommynator · Sep 22, 2011 at 09:48 AM

What kind of Collider are you using for your imported sphere model? If it's a MeshCollider, make sure to check 'convex' and 'smooth sphere collisions' in the component properties. I also don't recommend you to use MeshColliders if the base mesh very high poly, as you will run into performance issues quickly.

As an alternative I suggest to attach the built-in sphere collider. That should be insensitive to scale.

hope that helps - looking forward to the next Katamari Damacy ;)

Comment
Add comment · Show 5 · 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 FourSheds · Sep 22, 2011 at 10:21 AM 0
Share

Thanks, but I'm already using a sphere collider (I have to because the ball has too many polys for a mesh collider) . Using a sphere primitive (rather than model) does scale perfectly, but I need a particular poly and UV layout so I can't do that. The problem is repeatable even with the simplest test app, so it may be a physics bug, or just another episode in the "weird stuff happens when you scale geometry" story :)

$$anonymous$$atamari, lol, one day I'll have an original idea! ;)

avatar image Tommynator · Sep 22, 2011 at 10:59 AM 0
Share

I just tested the scenario with a simple test script but couldn't reproduce the jerky movement that you are experiencing. Did you try to use only default assets and see if the problem persists? (just to remove some points of failure)

[RequireComponent(typeof(Rigidbody))] public class move : $$anonymous$$onoBehaviour { private float scale = 1;

 void Update()
 {
     Vector3 move = Vector3.zero;
     if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.W))
     {
         scale = $$anonymous$$athf.$$anonymous$$ax(scale - Time.deltaTime, 0.1f);
         transform.localScale = Vector3.one * scale;
     }
     if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.A))
     {
         move += Camera.main.transform.TransformDirection(Vector3.left);
     }
     if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.S))
     {
         scale += Time.deltaTime;
         transform.localScale = Vector3.one * scale;
     }
     if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.D))
     {
         move += Camera.main.transform.right;
     }

     move.Normalize();

     rigidbody.AddForce(100 * move * Time.deltaTime, Force$$anonymous$$ode.Acceleration);
 }

}

avatar image FourSheds · Sep 22, 2011 at 12:38 PM 0
Share

Thanks, $$anonymous$$, that's very similar to what I'm doing, but are you importing a model or using a Unity sphere? As mentioned, it scales O$$anonymous$$ for me with a Unity primitive. But the fact that this is working for you too makes me wonder if there's something about the 528-tri model I'm using that Unity doesn't like.(Even though I'm using a Unity sphere colllider) I'm going to try a few alternative spheres, see if it makes any difference. If not, I'll post a simple test scene with my geometry.

avatar image FourSheds · Sep 22, 2011 at 12:53 PM 0
Share

O$$anonymous$$, apologies, I should have tried this before posting, but re-modeling the sphere has cured it. $$anonymous$$ust have been some bad vertex data lurking somewhere. But thanks again, $$anonymous$$, without your confirmation that it should work, I would never have suspected the model as it was basically a Cinema4D primitive that appeared fine in every other way.

avatar image Tommynator · Sep 23, 2011 at 01:51 AM 0
Share

no worries, glad it works now! But I still find it extremely strange, that your mesh that you used only for rendering can affect the physics behavior in any way - even though you are using a default sphere as collider. would be interesting to understand what misconfiguration caused the hickups.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Ball Doesn't Roll Down Hill - Physics Problem 3 Answers

Create a "free" rolling ball controlled by player 1 Answer

Simulating the graphics of a rolling 3D ball in a 2D game 2 Answers

How to make a "pressure sensor" of sorts that when rolled over switches to another scene 2 Answers

Ball jump on collision problem 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