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
3
Question by larrykirschner · Jan 14, 2011 at 05:10 AM · collidertriggercapsulecast

Physics.CapsuleCastAll not detecting kinematic+trigger colliders

I'm working on a force-scrolling 2d game where a horde of bad guys are chasing the hero.

The bad guys have kinematic rigid bodies and trigger (capsule) colliders. I made the rigid bodies kinematic, since I'm just moving the bad guys around (not using forces) and set the colliders to trigger, because if they were not triggers, they would not collide with other kinematic rigid bodies (cars and other hazards).

Collision detection is working the way I want it to except that when I do Physics.CapsuleCastAll(...) it doesn't detect the bad guys' trigger colliders.

The reason I'm doing the Physics.CapsuleCastAll() is for bad-guy AI--so they can avoid running into each other as they pursue the hero.

Physics.CapsuleCastAll(...) does detect my bad guys if I make their colliders non-trigger, but then they no longer collide with other kinematic rigid bodies.

In summary, a couple of quesstions:

1) Is Physics.CapsuleCastAll() not supposed to detect kinematic rigid bodies with trigger colliders? (all the docs I have found suggest that they should)

2) Is there a better approach for what I'm trying to do, e.g. I could make the bad guys' rigid bodies non kinematic; it just seems like real physics would be a pain in this type of force-scroll 2d game.

Thank you in advance for any help.

Comment
Add comment · Show 1
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 Proclyon · Jan 14, 2011 at 08:05 AM 0
Share

I had some similar issues with capsule cast problems. I would put this in the "start up" bugs for the new features category. Proper question btw m8, and smart choice on nailing error scope by replacing capsule cast with raycast Definatly +1 , wish I had any form of decent answer though :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jessy · Jan 14, 2011 at 05:16 AM

Physics Manager, RayCasts Hit Triggers, turn it on.

Edit: Nope, should have checked, but I'll leave this here so that others know this isn't the solution. I'm calling this a bug.

Comment
Add comment · Show 7 · 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 larrykirschner · Jan 14, 2011 at 05:27 AM 1
Share

Thanks for the quick reply.

I just looked at Physics$$anonymous$$anager, and Raycasts Hit Triggers is already checked, but somehow it's not seeing $$anonymous$$e.

I'm assu$$anonymous$$g all settings and rules for raycasting apply to capsulecast functions as well, but I might start experimenting with switching to raycast just to rule that out.

Any other ideas for what it might be?

avatar image Jessy · Jan 14, 2011 at 06:29 AM 0
Share

I'm very sorry, this should not be a problem. I just filed this as bug 388559.

avatar image Jessy · Jan 14, 2011 at 06:34 AM 0
Share

In the meantime, try this workaround found in the comment to my answer: http://answers.unity3d.com/questions/36453/what-is-the-proper-usage-of-spherecast/36456#36456

avatar image larrykirschner · Jan 14, 2011 at 07:36 AM 0
Share

Thanks for all your help and for filing the bug. The linked workaround doesn't work for me, but knowing now that the problem is with SphereCast/CapsuleCast and that RayCast does not have this bug, I switched my code to use RayCastAll. With RayCastAll, at least the collisions are detected, even if they're not as accurate as I wanted them.

Thanks again for all your help on this.

avatar image larrykirschner · Jan 15, 2011 at 02:51 AM 0
Share

FYI, below is the workaround I'm using. It's really only suitable for 2d case where false positives are not an issue, e.g. I'm using it for a very simple enemy path finding algorithm.

Show more comments

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

2 People are following this question.

avatar image avatar image

Related Questions

Can't click gameobject when over another trigger? 1 Answer

Play audio only once in trigger collision entry? 1 Answer

Access other collider without use of Trigger collider. 1 Answer

How to add a specific object from one array to another ? 1 Answer

How to handle multiple colliders for one enemy and bullet. 3 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