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 steinbitglis · Feb 13, 2012 at 10:40 AM · rigidbodycomponentmonobehaviourontriggerexitoncollisionexit

How to use rigidbody for characters

Hi! I'm creating a 2D game where the character is affected by a lot of external forces. We decided that, since it's a lot of physics, we'd use rigidbody as a basis for the character.

One of the most problematic issues is that a Rigidbody being destroyed, og deactivated, will not cause other colliders to go 'OnTriggerExit'. The same issue goes for 'OnCollisionExit'.

I think I could handle this issue in 'OnDestroy' and 'OnDisable', if all these objects had a custom component, written to handle the issue. Are there any issues with this strategy?

This will be one of the core mechanisms of our game, and the strategy we've been using so far (Coroutines checking a few times per second) feels like it's doing a lot of redundant work.

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 shaneapp · Feb 14, 2012 at 01:11 AM 0
Share

What exactly are you trying to do, any why do you want to destroy the rigidbody?

avatar image steinbitglis · Feb 14, 2012 at 01:40 AM 0
Share

Well, the character needs to know when he's falling etc. If whatever he's standing on is deactivated or destroyed, he's not going to receive 'OnCollisionExit'. That's the problem.

avatar image shaneapp · Feb 14, 2012 at 01:44 AM 0
Share

With something like that, could it not be solved some other way...like by using gravity? It seems like OnDestroy would be fine for this otherwise. What do you mean by 'if all these objects had a custom component, written to handle the issue'. What issue?

avatar image steinbitglis · Feb 14, 2012 at 10:43 AM 0
Share

Well, I need OnDestroy to be defined in a particular way, for every object that the character can collide with. That's a much bigger workaround that I had in $$anonymous$$d. All just because OnTriggerExit can not be trusted.

0 Replies

· Add your reply
  • Sort: 

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

6 People are following this question.

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

Related Questions

Caching a Monobehaviour Component's reference properties (rigidbody2d, specifically) 1 Answer

Do you tend to have scripts to mark prefabs 1 Answer

Enabling multiple Monobehaviour Components in a game object 1 Answer

Is it possible to mark MonoBehaviour as EditorOnly 2 Answers

Tank-Based Creation of Tank-Based Objects 0 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