• 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
2
Question by Cyriel · Jul 17, 2010 at 03:10 PM · animationrigidbodycollidertrigger

Trigger via Collider

Hello,

I have tested a script that triggers an animation via a collider. And it worked pretty well. However, when i put the same script on my character, wich has a rigidbody. It doesn't work. I changed the tags and names. It looks ok to me. but it just doesn't respond. Even the print-message don't work.

I also tried to add an capsule-collider. But that doesn't work either. Anyone had the same problem? I can't figure out what's going wrong. I DO get the message "NullreferenceExecption. But i can't see what's wrong. Any idea's?

Comment
Add comment · Show 3
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 Mike 3 · Jul 17, 2010 at 03:16 PM 0
Share

You'll need to post the code - NullReferenceException means you're doing something on an object which hasn't been assigned to, which is usually wrong

avatar image Cyriel · Jul 17, 2010 at 03:28 PM 0
Share

I just got the detection working. turned out i had the "target" on my script set to the model. But when i put it to "None" it worked fine. I'm sorry i posted this question for nothing, but maybe it can help out others..

avatar image Ashkan_gc · Jul 17, 2010 at 04:03 PM 0
Share

so answer it yourself.

1 Reply

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

Answer by Ashkan_gc · Jul 17, 2010 at 04:04 PM

many times the problem is not where you think. the other parts of the code has problems. if users post their codes it can be detected by others.

sometimes when you have rigidbodies your colliders are not trigger (i.e their is trigger is off) so OnTriggerEnter don't work and you should use OnCollisionEnter or make the collider a trigger.

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 Cyriel · Jul 17, 2010 at 05:01 PM 0
Share

that makes sense.. Thanks !! :) i'll keep this in mind!

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Possible to stop collider from "popping" through plane when re-centering? 2 Answers

OnTriggerStay2D Breaks When Adding AnimationController 1 Answer

OnTrigger's Moving Behaviour with Other Triggers 0 Answers

Trigger transition to another animation. 2 Answers

4.5.2 animation BUG: 2D collider colliding with 2d trigger!!! 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges