Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Mazze · Jun 06, 2011 at 02:26 PM · colliderfpsontriggerenteroncollisionenterfirst-person-controller

First Person Controller not working with OnCollisionEnter and OnTriggerEnter

Hey everyone!

So I've been searching on for forums for similar problems but all I've found is unanswered questions. So here it goes: I've been making an FPS game and I want somehting to happen when the Character enters a room. So I created a collider on a decal which the character has to go through in order to get into the room, and after a few seconds the door should close.

  1. I tried setting the decal into a trigger and used "OnTriggerEnter" in a script which is applied on the decal,didn't work.

  2. I've tried expanding the radius on the FPS controller (the standard from unity) -> nothing.

  3. tried to make the FPS controller into a trigger (with the help of a script) and tried to use "OnTriggerEnter" on the decal but failed there aswell.

  4. I tried with OnCollisionEnter which also failed and resultet in no response

So what should I do?, what am I doing wrong?

Comment
Add comment
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

1 Reply

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

Answer by mwebi · Jun 06, 2011 at 03:09 PM

You could try calling the void OnControllerColliderHit(ControllerColliderHit hit) function of the controller. http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnControllerColliderHit.html

Comment
Add comment · Show 3 · 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 Mazze · Jun 06, 2011 at 03:30 PM 0
Share

But since i'm walking on a mesh that would mean that the function would be called several times. Guess I can solve it that way and check what it hit using tags. Just looking for a way to do it more efficiently

avatar image aldonaletto · Jun 06, 2011 at 03:47 PM 2
Share

I use OnTriggerEnter for this purpose, and it always works fine to me. Have you set the Is Trigger checkbox in the collider? I usually put a cube, resize it and disable the mesh renderer, so it's invisible, and check Is Trigger. There's a small problem, too: if the trigger is too thin, nothing happens. It seems the Character Controller collider must "penetrate" the trigger volume a $$anonymous$$imum length in order to be detected.

avatar image Mazze · Jun 06, 2011 at 04:08 PM 0
Share

@aldonaletto: Solved it! thanks for the tip =)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to detect collisions in C# 2 Answers

Destroying an object on collide depending on the impulse magnitude. 0 Answers

Character collider falls away unless "isTrigger" selected 1 Answer

How to make gameObject make only one collision 1 Answer

Character controller collider? 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