I have my character model, which has a box collider encompassing it. The character model has an invisible cylinder around its waist that has a circle collider attached. I'm trying to lower to speed variable when the circle collider touches something. How do I do this?
(comments are locked)
|
|
Is the circle collider actually a trigger? Yes, it is a trigger.
May 26 '12 at 03:33 PM
Sting_Auer
(comments are locked)
|
|
Ok so you need to change your code in OnTriggerStay to use the name of the object you are hitting. The code you have at the moment is trying to find a script called clipcheck. Note that you will only get a trigger firing if one of the items has a rigidbody attached
May 26 '12 at 04:15 PM
whydoidoit
I replaced the faulty part of my code with this, and it isn't working. It doesn't affect the speed of my character. EDIT: Never mind, I'll assign it a rigidbody now and see if it works. EDIT AGAIN: How do I make the sphere collider not touch the main box collider? The problem I have now is that the sphere collider is touching the box collider on the actual character model, causing the speed to always be super low.
May 26 '12 at 04:18 PM
Sting_Auer
Also the sphere collider might well be colliding with the box collider - was this why you were checking for something in OnTriggerStay?
May 26 '12 at 04:21 PM
whydoidoit
All I was trying to do was detect if the character model was against a wall. That's why I created a sphere collider around its waist that was attached to a different object. I can refer to the sphere collider around the cylinder using the 1 script. The problem I have now is that the sphere collider is touching the box collider that it is inside. How can I make the 2 colliders ignore each other?
May 26 '12 at 04:24 PM
Sting_Auer
If you don't want physical colliders colliding with one another, you can give them a tag "No Collision", then go into your Physical Settings (Edit > Project Settings > Physics), and uncheck the No Collisions with whatever other tags you don't want it to collider with
May 26 '12 at 04:32 PM
oliver-jones
(comments are locked)
|
|
Sphere collider, not circle. Circle is 2D. Why do you need an invisible Cylinder ? A gameObject with only the collider would do the same. Is that code on that gameobject, the one with the sphere collider ? Are there any game object physically moved that can enter that object, or is it the one moving ? The latter case will not raise trigger events. There is a way, though.
(comments are locked)
|

So the thing your colliding with needs to have a clipcheck script on it right? I'm guessing it has that.
Also can you reformat your code by editing your question, highlighting the code, and clicking the "code" button (the one with the 1 and 0 on it). Thanks.
Actually I don't have a Clipcheck code on anything else, I named the cylinder "clipcheck", so I'm trying to find out how to detect a trigger from that cylinder, and have it change the speed variable.