• 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 Topthink · Dec 14, 2016 at 04:56 PM · physicscollidertrigger

Collider Lifts me off Ground ??? And I'm afraid of heights !!!

Okay, I'm not really afraid of heights.

I have one friendly cube (or more) and I have some enemy cubes that move around on a terrain. But the enemies are double-secret cubes and they are invisible to my friendly cube...until they get close.

I'm trying to make them "visible" when they get inside a certain distance so I added a larger sphere collider to all my cubes and put a trigger on them...so when the larger sphere colliders touch, the dreaded enemy becomes visible.

However, my sphere colliders are not fully cooperating because the spheres totally encircle my cubes and because of physics, when the collider touches the ground, they elevate my cubes off the ground. I'm not sure how to set these sphereoid colliders so that my cubes can glide smoothly across the surface of my terrain.

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 Topthink · Dec 14, 2016 at 05:57 PM 0
Share

Clarification: I have two colliders on my cubes. One is a cube collider, the same size as the cube, that detects collisions. The other is the "large spherical" collider (much larger) that acts as a trigger to make nearby units visible.

avatar image Topthink · Dec 14, 2016 at 06:02 PM 0
Share

One thing I just found is a 2-D circle collider. Hmmmm. I'm going to test that to see if it works.

Anyone know how the trigger event would be affected if the two cubes were at slightly different altitudes?

avatar image Topthink · Dec 14, 2016 at 06:04 PM 0
Share

Never $$anonymous$$d. I can't add a 2-D collider...I get a message that it "conflicts" with my box collider on the cube.

So much for that idea.

avatar image Topthink · Dec 14, 2016 at 06:09 PM 0
Share

LoL. I didn't have "Is Trigger" checked. I just checked that and it may be just what the doctor ordered.

If this is the solution, I'm very sorry for taking up anyone's time. I'm testing it now.

1 Reply

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

Answer by Hanoble · Dec 14, 2016 at 06:20 PM

Make sure the IsTrigger bool is checked on the collider, which in code will mean you need to be using the "OnTriggerEnter" callback as well. Another thing you can do is set the layers if you want that trigger colldier to only interact with the player, as this will make it easier on the physics side as well.

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 Topthink · Dec 14, 2016 at 06:37 PM 0
Share

Thanks. That indeed fixed the problem for me. I'm not sure how I missed that. I've been working with C# for some time but I'm fairly new to Unity.

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

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

Related Questions

Collider/trigger collision causing physics glitch 0 Answers

overlapsphere to destroy NPCs on exit 1 Answer

Prevent shooting when gun is inside wall 1 Answer

Trigger Colliders: Is there a way to simulate a non-trigger collider? 0 Answers

How do i get OnTriggerStay2D to work? 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