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
1
Question by KeithK · Apr 02, 2011 at 08:43 AM · physicsrigidbodyaddforce

Rigidbody "hopping" when crossing objects.

I cannot figure out what the cause of this is. I really hope somebody can shed some light on the cause.

I have a rigidbody with a simple sphere collider on it. My level is made up of static collidable tiles (all of equal size). When the rigidbody collides with these tiles, certain tiles apply a forward force to it with the following script:

void OnTriggerStay(Collider TheCollider)
{
    TheCollider.rigidbody.AddForce(new Vector3(forceMagnitude, 0.0f, 0.0f), ForceMode.Force);
}

Now for some reason when the rigidbody crosses from one tile (the one applying the force) to another (a plain static collidable) it does a little hop as if it's hit a little step or something. I'm sure that my tiles line up perfectly square and that they are airtight where they touch each other.

Any advice would be greatly appreciated. Thanks in advance.

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

2 Replies

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

Answer by KeithK · Apr 03, 2011 at 01:29 PM

Eureka!

For anyone else having this problem. There is a setting in Edit->Project Settings->Physics called "Min Penetration For Penalty", this basically sets how much an object can penetrate another before being pushed apart.

My player sphere was penetrating my map tiles a little too much, and when it hit the next tile, it was like hitting a step up. This sorted it out like a charm.

Comment
Add comment · 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
0

Answer by Bunny83 · Apr 02, 2011 at 09:02 AM

Does your tile have a seperate trigger collider on top, or do you just mark the collider as trigger?

Colliders that are marked as trigger don'e "collide" and don't give physics feedback. Trigger can passed through, they just "trigger" something. How big are your tiles in relation to your player sphere? If you move quite fast you will just fall into the tile and then hit the edge of the next tile which pushes you up again.

Can't think of anything else...

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 KeithK · Apr 02, 2011 at 02:55 PM 0
Share

Thanks for the quick reply. I tried commenting earlier but had a power failure while I was typing it -_-.

$$anonymous$$y tiles have a separate trigger collider added as a child.

The size of the tiles is 1 unit in all dimensions, and the player sphere is 10 times small, so 0.1. I think you're right that it is falling through and hitting the next tile's edge.

Could the physics engine not be enjoying the size of my player sphere?

avatar image Bunny83 · Apr 02, 2011 at 03:55 PM 0
Share

That means your tiles are Unitys' default cubes? ;) If you use Boxcolliders for your tiles everything should be ok. Even a PlaneCollider should work. $$anonymous$$ake sure the collider is not marked as trigger. You can or should check this at runtime. When you enter playmode you can switch to the sceneview and select your tiles to check that there's a collider (maybe it got removed by a script?) and it does collide. You can even add a test-sphere with rigidbody right above the tile to see whether it falls through or not.

avatar image KeithK · Apr 02, 2011 at 04:17 PM 0
Share

Haha. Yep, you got me, it's the default cube. They do each have a BoxCollider, which is definitely there at runtime. They are positioned right next to each other and the hop only happens at the touching sides of the cubes, it's also dependent on the velocity of the sphere at that time, some cubes it crosses over to fine. I am completely stumped as to what the cause is.

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

No one has followed this question yet.

Related Questions

Ball physics help 2 Answers

Recieving a nullpointerexception while following the Unity Instantiation tutorial 1 Answer

Multiple rigidbodies stick together but still reacting to collisions from other entities? 0 Answers

Child Gameobjects are not fixed to the parent when using physics 0 Answers

calculate time to reach a target of rolling rigidbody sphere 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