|
Hiya. I am doing my first ever unity-project, and I find it excruciatingly much more trouble than Visual Studio or Flash ever was. Enough about that, forward to the problem at hand. My FPS character that I made myself because the built in one did not suit my purpose walks into a cylinder. This cylinder is in fact a portal. I do not ask for being able to see through it, I just want to transport. Right now, I am happy if ANYTHING can get through it. I attached the following code to the portal.
And quite plainly, it does not do anything. I can stand on the portal, I can blast it, I can jump into it, but I do not arrive at position 0, 0, 0. It does not even write "Somethin'". The code is clearly not called upon. Many of you probably silently thought about how stupid and easy a mistake I have made. Please tell me what it is. Thank you. Sincerely, PlatinumSkink
(comments are locked)
|
|
Does your FPS character have a Rigidbody or a CharacterController component? Without either of those, OnTriggerEnter can never fire. Also, make sure the thing that you are colliding with isn't just a collider, but a "trigger." There is a "is trigger?" checkbox on the collider that needs to be checked, or the onTriggerEnter code will never be called. Alternatively, just change the code to OnCollisionEnter and see if it works.
Jan 03 '11 at 04:40 PM
Bob5602
It has a Rigidbody, though not a CharacterController. I found I did not need it for my purposes, and in fact, as my controller is now adding a CharacterController would create complete chaos and errors everywhere. I hope a Rigidbody is sufficient.
Jan 03 '11 at 04:42 PM
PlatinumSkink
Yeah, a rigidbody should be fine. As bob said, do you have "is Trigger" set to true on the collider component of the transporter thing?
Jan 03 '11 at 04:54 PM
PrimeDerektive
(comments are locked)
|
If you create a box or something and attach a rigid body to it and let it fall into the portal, does it trigger the "Somethin'" message? If it does, then it sounds likely that either:
If it doesn't register the message even with the rigidbody, then your object might not have the script and trigger attached on the same object. I have answered a similar question that might add more insight. I felt this was related so I crosspost. Wow. Thank you. I may have already solved the problem from reading what Bob wrote, but you offered me an alternative way of solving the entire teleporting issue. My game is pretty teleporter heavy, so this may come of great help. Thank you.
Jan 03 '11 at 05:01 PM
PlatinumSkink
(comments are locked)
|

Thank you very much. I had somehow (./) managed to not figure out that I must click on a box in the inspector view to make a certain code work. You have saved me from many hours of frustration.
I had not clicked the "Is Trigger" box, and I had not even registered that it existed. One less detail I will never have a problem with again, at least.
Thank you, Bob, for pointing this out to me. Thank you, Derek, for pointing out another fact that I was not aware of. I will now continue on my path of failing codes, and will probably return in a few moments.
Thank you. Sincerely, PlatinumSkink.