Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by Team_26 · Mar 28, 2014 at 02:35 PM · colliderfirst-person-controllerfpc

[CLOSED] FPC's childrens can't have collisions?

Eh.... Next question and next waiting for answer :P. OK, I've got a small problem. I add some children to First Person Controller. These childrens have colliders, but they are doesn't work when the objects are childrens of FPC. How to solve this problem?

Photo for Gruffy:

alt text

For collisions I tried this:

 OnCollisionEnter(Collision col)
 {
       if(col.gameObject.tag == "Hook") // The Hook is one of FPC childrens
       {
             Debug.Log("Hook collider works fine. Collision detected.");
       }        
 }

I'm sure that this code works, because I use it many times, but note that I tried to use "OnTriggerEnter" too. I attach this script to object in the scene and collide Hook with it, but Console is doesn't show my message. Hook is the children of First Person Controller and it has box collider attached to it.

bez tytułu.png (4.9 kB)
Comment
Add comment · Show 9
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 Destran · Mar 28, 2014 at 05:18 PM 0
Share

Are they marked as triggers?

avatar image Team_26 · Mar 28, 2014 at 05:21 PM 0
Share

No........

avatar image Leuthil · Mar 28, 2014 at 05:26 PM 0
Share

Does the First Person Controller have a Rigidbody?

avatar image Team_26 · Mar 29, 2014 at 09:52 AM 0
Share

No, it has only "Transform", "Character Controller" and my scripts components.

avatar image Team_26 · Mar 29, 2014 at 11:52 AM 0
Share

... No idea for solve this problem? ...

Show more comments

1 Reply

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

Answer by Gruffy · Mar 29, 2014 at 04:03 PM

OKay, so firstly, you need to put a box collider or whatever collider type you wish on your hook. You say thats already done, so does it look like this... ![Image OF collider with "isTrigger"][1]

If so, does it have you script attached to detect collisions?

If yes to that, then do the gameobjects you fish for have colliders attached to them?

If yes to the above, do those gameobjects also have rigidbodys with "isKinematic" checked and "Use Gravity" unchecked attached to them.

If so, from here and in the script you have attached to your hook game object that should be detecting a collision as such, Place this in to your script and remove any other methods that were trying to do this before.

 void OnTriggerEnter(Collider col)
 {
 if(col.gameObject.tag == "Fish")
 {
 Debug.Log("Fish Triggered Hook");
 }
 }
 
 void OnTriggerStay(Collider col)
 {
 if(col.gameObject.tag == "Fish")
 {
 Debug.Log("Fish still at hook");
 }
 }
 void OnTriggerExit(Collider col)
 {
 if(col.gameObject.tag == "Fish")
 {
 Debug.Log("Fish left Hook");
 }
 }


Finally, you NEED to go to your game object fishy and ass the Tag "Fish" to them and make sure each one or your prefab has it in its Tag slot at the top of gameobject`s inspector. [1]: /storage/temp/24485-unity-answers.png


unity-answers.png (23.6 kB)
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 Gruffy · Mar 29, 2014 at 05:14 PM 0
Share

Changed to answer. Take care bud. Gruffy

avatar image Team_26 · Mar 29, 2014 at 05:19 PM 0
Share

Vote for you :)

avatar image Gruffy · Mar 29, 2014 at 06:12 PM 0
Share

Thanks bud. Happy coding

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

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Collider causes terrible lags 1 Answer

First Person Controller not working with OnCollisionEnter and OnTriggerEnter 1 Answer

Player walks through everthing 0 Answers

FirstPersonCharacter 1 Answer

First Person controller Mouse Look isn't working 10 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