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 richarde · Oct 21, 2012 at 03:09 PM · triggercollision detectiongame objects

Why does collision detection stop?

I have an Enemy game object that has a RigidBody and a Box Collider (with trigger) on it. I also have a Player game object that has two child objects each with a trigger Box Collider on it - one called Shell and the other called RangeFinder.

The idea is that as the Enemy moves forward, if it collides with the RangeFinder child object, the Player starts firing Bullet objects at the Enemy. If the Enemy hits the Player's Shell object, the Enemy stops moving.

Naturally, if a Bullet object hits the Enemy object, the Enemy takes some damage and the Bullet is destroyed.

This all works perfectly for me until the Enemy stops moving (and this is based on a simple flag in the Update function). When the Enemy stops, its as if they become transparent to the Bullets.

The RangeFinder is still working because the Bullets keep getting fired but the Bullets pass straight through the Enemy.

If I tell the Enemy to start moving again, the Bullets again hit the Enemy but the moment the Enemy stops moving, the Bullets pass through again.

Can anybody explain this strange behaviour? And how do I go about getting it so that it works correctly?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by MountDoomTeam · Oct 21, 2012 at 06:21 PM

set collision mode to continuous for the enemy. it should be in their collider options. to save memory, normal collision mode is interpolated or something like that which means it skips frame so I don't know what, which is not good for fast moving objects and small objects, also try setting the bullet collider as continuous, actually colliders doing seemed to be that well adapted for bullets that move fast, there is continuous detection mode I don't know tell what you reckon.

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 richarde · Oct 23, 2012 at 05:42 PM

Thanks Zoom. I did think of that pass-through situation too but that didn't fix it.

But you did get me thinking and I did some testing. If you are testing for a collision between two objects and only one has a RigidBody attached, then if the object with the RigidBody is stationary, it doesn't matter what the other object does. It will never trigger a collision trigger event of any sort. But if the RigidBody object is moving, then both objects receive the collision trigger events.

To my mind, this doesn't make a whole lot of sense. The collision trigger event should occur regardless of whether the RigidBody object is moving. The only reason I even have a RigidBody on the object in the first place is that Unity won't recognise collisions otherwise. When you don't care about the physics of the collision, it seems redundant and ineffecient to me to have to attach RigidBodies to every object just to guarantee that you get the collision trigger event.

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 Anusha · Apr 19, 2013 at 09:36 AM

Move ur bullet inside FixedUpdate()[so u can get exact/even time interval] and then keep its collision mode continues dynamic[coz its moving very fast], make ur enemy collision mode continues.

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

11 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

Related Questions

Triggering sounds on collision?,Rigged Character animation collision 2 Answers

get only one colliding body 3 Answers

Trigger with object only from top side. 0 Answers

Why are my OnTriggerEnter2D events firing only on android in a situation they shouldnt be firing? 0 Answers

Trigger events sometimes not working disregarding frame rate 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