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 Filippopotamus · Jul 23, 2012 at 06:11 PM · animationcollisionphysicscolliderprojectile

Collision occurring when it should not! Help!

[EDIT]: One more related oddity: I have line renderer showing the trajectory the projectile will take when I shoot it. This trajectory also shows an "X" where it is going to hit and that X faces the normal of that collision point. Interestingly enough, when I point to these "bad areas", the trajectory does SOMETIMES stop there and shows an "X". As if there was a collider there. But when I look at the scene, there is absolutely no collider there (even when selecting everything in the scene with Crtl+A/Command+A).

I have a game where you are constantly throwing things at people. Simple colliders for the characters and the environment as well as the projectiles. The only things with rigid bodies are the projectiles and some small props in the game.

Everything works fine. But after playing the game for a good 10 minutes, random collision start to occur. I throw projectiles and they bounce out of nothing. Or I throw them and they seem to enter some sort of "anti-gravity field" where they freeze mid-air (but continue their rotation). I can pause the game at that point, and when I look at the entire scene, all my colliders seem correct and in their right place. The scene looks perfectly fine. But collision start occurring where they should not. These "bad collision areas" stick around and sometimes seem to be part of the characters. So once these collision areas occur, they don't disappear. The game just gets more and more of those over time until it is unplayable. I say at least some of them seem to be related to the characters, because sometimes when these characters with these bad collision areas tend to push away certain props of the environment when they are nowhere near them.

Even more odd, when I hit these bad areas, sometimes it triggers the OnCollisionEnter methods of multiple characters, who should not be related at all! So lets say I hit this bad collision area which seems to be related to character A, both character A and character B respond to that collision at the same time!

Has anyone experienced anything similar to this? Can anyway shed some light on this because I have run out of ideas.

Thank you so much in advance.

Cheers,

Filipe

Comment
Add comment · Show 19
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 ScroodgeM · Jul 23, 2012 at 06:14 PM 0
Share

do you destroy unneeded colliders, rigidbodies and other physic-relative objects?

also try to watch at your gameplay using profiller - may be some overflows happened

avatar image Muuskii · Jul 23, 2012 at 06:24 PM 0
Share

You say that the colliders all seem to be in place but have you checked your Hierarchy tab for spare objects floating around? If you click on one of those you may see un-deleted colliders hovering where you're having trouble.

Also, some of your issues almost sound like they have something to do with parenting. Do you have any scripts that change objects' parent?

avatar image Filippopotamus · Jul 23, 2012 at 06:26 PM 0
Share

I set my projectiles to destroy themselves 3 seconds after they hit anything by doing this on OnCollisionEnter (I do a few checks first and then call this):

transform.parent = null; Destroy(gameObject, 3.0f);

Looking at my hierarchy I don't any left-over projectiles there. They seem to be disappearing as they should. Is there anything in particular I should look for using the profiler? Thank you so much for the help!

avatar image ScroodgeM · Jul 23, 2012 at 06:29 PM 0
Share

look at CPU usage - does it increasing during gameplay and are there any bottlenecks at the moment of your lags occurs

if it does, look for what is overload source

avatar image Filippopotamus · Jul 23, 2012 at 06:35 PM 0
Share

@$$anonymous$$uuskii, All the projectiles are instantiated without any parent. Some projectiles do stick to character, so I do parent those in script to the characters, which I thought was the problem. However, I am not using these projectiles in order to isolate this issue and it still occurs without any parenting change. There are no trailing objects. They seem to be destroyed correctly.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by wmgcata · Jul 23, 2012 at 06:14 PM

I remember myself having this problem before. Seems to me it hasn't got anything to do with your script, but with the collision with other objects. Try to make sure your rockets aren't colliding with anything else when firing them. That's the only tip i could give. There's probably other people who have any other suggestions?

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 Filippopotamus · Jul 23, 2012 at 06:40 PM 0
Share

"Seems to me it hasn't got anything to do with your script, but with the collision with other objects." Can you elaborate a bit on this? About collision when firing, prior to firing, the projectile lays on a box collider with a layer "Pullplane" while all projectiles are in a layer "Projectiles". On the Layer Collision $$anonymous$$atrix on Physics preferences, "Pullplane" is set not to collide with anything. It is there only for Touch raycasting to detect where you want to shoot the projectile from.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Projectiles, their speed, and collisions 1 Answer

OnCollisionEnter but have colliding object not move the object it collides with 1 Answer

Physics.OverlapSphere not giving proper coordinates 1 Answer

Collission and Trigger on Same object 0 Answers

Mouse Movement with physics 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