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 /
  • Help Room /
avatar image
0
Question by siddharth3322 · Jan 17, 2016 at 03:40 PM · collisionrigidbody3dunity5meshcollider

Collider not working when I am inside model

Basically I am working on Golf Water Globe 3D game.

alt text

In this my Golf Ball can't able to collide with Globe. I have set Golf Ball as Sphere collider and attached rigidbody as well. Globe has Mesh collider.

Golf ball is inside globe. So at present Golf Ball is not at all colliding with Globe. Globe is open from bottom side and I double check this thing.

Tee on which Golf ball is standing that has Mesh collider, Golf ball gets collided fine with Tee.

So I am very confused in this. Please give some suggestion in this.

[2]: /storage/temp/62166-screen-shot-2016-01-17-at-81938-pm.png

screen-shot-2016-01-17-at-81938-pm.png (80.9 kB)
golfglobe2.jpeg (9.0 kB)
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
1
Best Answer

Answer by Fattie · Jan 17, 2016 at 04:36 PM

I would like to tell you first that

YOU NEVER USE MESH COLLIDERS IN GAMES.

Notice immediately above where it says

YOU NEVER USE MESH COLLIDERS IN GAMES.

Hopefully you now understand that

YOU NEVER USE MESH COLLIDERS IN GAMES.

It is endlessly confusing that Unity included "mesh colliders" in the system, it leads to endless confusion like this. You'll find 1000s of questions about mesh colliders where the answer is "don't use mesh colliders". There are some extremely unusual situations where you use mesh colliders, and you in certain situations use them for the "ground", but generally they're never used.

So just to begin with, regarding your tee,

remove the mesh collider.

Use one (or maybe two) ordinary colliders to represent the tee. That's how you make games - for example, a car would be probably two box colliders. A dog might be represented by 3 or 4 colliders (or just one if you're not too close); and so on.

Many people don't realise this extremely basic aspect of game engineering. It causes huge confusion.

In this case just use maybe a cylinder collider and a small box collider on top to represent the tee (or indeed - just use one trivial box collider (tall and thin) and that will very likely be fine).

So first do that.

once you've done that and absolutely have the tee working (properly, using perhaps one box collider), come back for the main part of your question:


Secondly, regarding your main question, the fundamental reason your ball is not colliding with the "glass" collider:

don't forget colliders (and indeed mesh) are one-way.

The "collison" is of course on the outside of a collider.

There's no collision "leaving" a collider, it's meaningless. (Just as shaders only paint one side of mesh.)

You can see this explained often, example

http://answers.unity3d.com/questions/376773/inside-box-collider-falling-through-but-works-if-i.html

Note that you could indeed use it as a TRIGGER, to learn when something goes outside the collider (so, http://docs.unity3d.com/ScriptReference/Collider.OnTriggerExit.html and so on)

In any event, you are in the very unusual situation where you want to be "inside" a collider. It's unfortunate that your first project where you're just getting going -- you have not yet reached the point of realising you don't use mesh colliders in games -- has this issue.

After you fix the tee as explained above,

You can easily google many solutions for "I am inside a collider" or "inside-out collider".

Since the thing you are inside is a sphere, fortunately one solution is extremely easy:

http://answers.unity3d.com/answers/469959/view.html

Alternately if you want to "TURN THE MESH INSIDE OUT",

here's the FULL SOLUTION

http://answers.unity3d.com/answers/369468/view.html

To repeat, SIMPLY GOOGLE "hit mesh from inside" and you'll find many such solutions.

Comment
Add comment · Show 11 · 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 siddharth3322 · Jan 17, 2016 at 04:48 PM 0
Share

Thanks sir for all this information. but I think for globe I need to use mesh collider only. I can't able to find any other option for this object.

I understand your Tee object concept and implement same in game.

I want my golf ball collide with globe surface. Can designer help me in this? so that whatever mesh collider is generated gives me reverse effect.

avatar image Bonfire-Boy siddharth3322 · Jan 17, 2016 at 06:01 PM 0
Share

You've got 2 spheres, so it's very straightforward to detect the collision yourself. It happens when the distance of the centre of the ball from the centre of the globe is (globeradius-ballradius).

avatar image Fattie Bonfire-Boy · Jan 17, 2016 at 06:31 PM 0
Share

Hi Bonfire, I'm not sure if you noticed, indeed I gave the OP the full code for that:

http://answers.unity3d.com/answers/469959/view.html

Show more comments
avatar image Fattie siddharth3322 · Jan 17, 2016 at 06:33 PM 0
Share

Hi Siddhart,

I guess something was not clear,

here is the FULL SOLUTION if you do want to "turn the mesh inside out"

http://answers.unity3d.com/answers/369468/view.html

note the last few sentences of the answer, i edited it

avatar image Bonfire-Boy · Jan 17, 2016 at 05:59 PM 2
Share

In my opinion this answer is far too dogmatic. Yes, if there's an alternative to using mesh colliders (and yes, in this case there is) then one should usually use it. But there isn't always a better alternative.

avatar image Fattie Bonfire-Boy · Jan 17, 2016 at 06:34 PM 0
Share

Hi Bon, Can you give an example where you've used a mesh collider?? include pic if you like. Or just describe the situation

avatar image Bonfire-Boy Fattie · Jan 17, 2016 at 06:43 PM 0
Share

I can't be specific (not allowed) but I've worked on several highly ranked mobile games that use them extensively. If precision is a priority and you have highly irregularly shaped objects then there might be no alternative.

Show more comments
avatar image dyburke · Jul 12, 2020 at 10:07 PM 0
Share

$$anonymous$$esh colliders are fine for static objects where a primitive shape doesn't do a good enough job to detect when two things should be colliding... Please don't write your answers so absolute (and stop using unnecessarily large text). If you're annoyed; take a walk.

Also, knowing when something has left a volume is not "meaningless" and, similarly, knowing when something has stopped colliding is equally not "meaningless". That's why OnCollisionExit and the triggers you mentioned exist.

avatar image Leniaal · Nov 30, 2020 at 05:26 PM 0
Share

Damn, you must have only made very simple games in your life to be able to think this way. Next time try to use fonts and capslock like you are older than 10.

avatar image
0

Answer by stvz · May 26, 2017 at 06:10 PM

@siddharth3322, simple, reverse normals of your mesh.,simple, reverse normals of your mesh.

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

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

49 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 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 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 avatar image avatar image avatar image avatar image

Related Questions

Unity Annoyance with Physics Help C# Scripting Problem Momentum Issue Please Help 0 Answers

Collision Detection Modes not working for what I need? 0 Answers

Why is my Character's BoxCollider getting stuck in between two wall BoxColliders? 0 Answers

[3d]Rigidbodies are not working as expected with animations, They are not stopping on colliding, Am I doing anything wrong? 0 Answers

Why do I fall really far when I collide with something? 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