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 microp · May 11, 2011 at 10:14 PM · collisionrigidbodycollidertrigger

Objects placed manually collide, but don't if instantiated?

Yo,

I've been racking my brains for a day over this one. I have an explosion prefab which has a static trigger collider (no rigid body). I also have a turret prefab, with both a (non-trigger) box collider and a kinematic rigid body. According to the collision matrix , they should collide fine with each other.

Indeed, they do if I place them manually in the scene, on top of each other. As soon as the game starts, I can break in OnTriggerEnter() properly. However, if I instantiate them at run time, they utterly refuse to interact in any way.

Would anyone have any sort of idea as to what might be happening? Thanks!

Comment
Add comment · Show 8
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 microp · May 11, 2011 at 11:34 PM 0
Share

Also, because they collide fine when placed manually, we can be sure that the layer-based collision matrix isn't the culprit.

avatar image microp · May 11, 2011 at 11:35 PM 0
Share

Apparently, it might have something to do with my explosion script destroying the object within one frame. Once again, for some reason it works when the objects are created manually, but not at runtime.

avatar image microp · May 11, 2011 at 11:53 PM 0
Share

The call order when the objects are instantiated manually is Awake(), OnTriggerEnter(), Update(), while on runtime instantiation, it's Awake(), Update(), OnTriggerEnter(). The code that destroys the explosion object is in Update(), so that makes sense.

Now, why is the order different? That's still a mystery.

avatar image microp · May 12, 2011 at 12:48 AM 0
Share

Well dayum, I just don't get it. Sometimes it just works perfectly. I'm baffled.

avatar image lil_billy · May 12, 2011 at 12:50 AM 0
Share

so im confused, what exactly is supposed to happen, why does explosion prefab need to be static or for that matter have a collider.etc and how exactly are they interacting and supposed to be interacting

ps-the collision matrix isnt exactly spot-on, colliders have a rather finicky nature especially when it comes to hierarchy and overlapping colliders, oh and spawning colliders within or outside of colliders

Show more comments

1 Reply

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

Answer by microp · May 12, 2011 at 02:38 PM

I'm closing this question, as its description and my own torrent of comments make it more complicated than it should be.

Also, frustration.

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 microp · Jun 21, 2011 at 06:03 PM 0
Share

See lil_billy's comment above for possible cause. I ended up working my way around all of this mess by using a SphereCast.

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

1 Person is following this question.

avatar image

Related Questions

Collision not working at all [ABANDONED] 4 Answers

How to get collision point when using onTriggerEnter 5 Answers

How do i get OnTriggerStay2D to work? 1 Answer

Collisions - bounce of walls but not from characters (while still reacting with them) 0 Answers

Can't add Rigidbody component because collision prevents it 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