x


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?

more ▼

asked Jul 17 '10 at 03:10 PM

Cyriel gravatar image

Cyriel
33 2 2 5

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

Jul 17 '10 at 03:16 PM Mike 3

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..

Jul 17 '10 at 03:28 PM Cyriel

so answer it yourself.

Jul 17 '10 at 04:03 PM Ashkan_gc
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jul 17 '10 at 04:04 PM

Ashkan_gc gravatar image

Ashkan_gc
9.1k 33 56 117

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

Jul 17 '10 at 05:01 PM Cyriel
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3782
x1788
x1692
x984

asked: Jul 17 '10 at 03:10 PM

Seen: 1218 times

Last Updated: Jul 17 '10 at 03:10 PM