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
0
Question by MrCrinkle · Jan 21, 2014 at 12:37 AM · collision

Best way to ignore y component for certain collisions?

I have a sort of top-down shooter game I'm working on, so for the bullets' collision I only want to check for x and z positions and ignore the y. An obvious way to do this would be to make all the colliders really tall so they will always hit regardless of y, but I also need to use those colliders for physics collisions.

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 Benproductions1 · Jan 21, 2014 at 02:22 AM 0
Share

$$anonymous$$aybe you can try different colliders in different layers. How are your "bullets" colliding?

avatar image MrCrinkle · Jan 21, 2014 at 02:48 AM 0
Share

Is it possible to have multiple colliders on the same object? The bullets are just using box colliders.

avatar image SunnyChow · Jan 21, 2014 at 03:31 AM 0
Share

no but you can add collider in its child objects. I agree you should layers .. may you give us more information?

avatar image iwaldrop · Jan 21, 2014 at 05:42 AM 0
Share

Actually, you can have multiple colliders in newer versions of Unity. I forget when they added it, but it definitely works as of 4.3. However, all colliders will be on whatever layer the game object is set to.

The only elegant way of achieving what you're talking about, I think, is by perfor$$anonymous$$g a sphere cast or something along the y axis during fixed update.

1 Reply

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

Answer by ankush_Kushwaha · Jan 21, 2014 at 06:33 AM

You can add another child game object to you existing game object. And add a collider into new child object. And mark the new collider as IsTrigger. And use IsTriggerEnter() to detect the bullet collision. By using IsTriger your new child game objects will not be able to collide physically with other collider

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 MrCrinkle · Jan 21, 2014 at 10:29 PM 0
Share

This is how I ended up doing it. $$anonymous$$ind of annoying having to add a child object just for a collider, but it's working.

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

20 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

Related Questions

How do I change collision according to gameobject - ground color? 1 Answer

Camera looking through objects when touching 1 Answer

get angular velocity change from collision 0 Answers

Unity2D side collision detection 1 Answer

How do I increase speed after collision? 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