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
1
Question by violyn · Apr 22, 2011 at 07:42 PM · terraincolliderstreespaintingtree-painting

Painted trees do not take their prefab's collider

The trees I painted on my landscape do not have colliders, despite the fact that Unity is painting a prefab which has a collider. In fact, if I place that same prefab on the landscape directly, the tree does have a collider. It's only when I paint the trees does this problem occur. Is it something about painting that makes everything collider-less?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by zmar0519 · Apr 22, 2011 at 07:50 PM

I'm not sure how to do this either, but you could, in the terrain collider script, check generate tree colliders. Or, you could download the terrain assets on the unity website and use the sicomore with collider prefab for a tree. Hope it helps!!! :)

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 violyn · Apr 22, 2011 at 08:23 PM 0
Share

Thanks, but I did try those. I guess I'm stuck placing the trees by hand.

avatar image violyn · Apr 22, 2011 at 09:39 PM 0
Share

Ah, I got it solved! The adding prefab to the painted tree option finally worked. Don't know why it didn't do it before....

avatar image zmar0519 · Apr 23, 2011 at 12:28 PM 0
Share

Glad I could help

avatar image
0

Answer by GeorgeRigato · Nov 12, 2012 at 01:28 PM

I've done both. Capsule collider COMPONENT in a tree and for other trees I have added two or more GameObjects Capsule with collider to the tree prefab.

only the collider component generate a proper collision.

Maybe if all the capsules inside the trees have a rigidboy attached, the collision with a standard unity's FPS character would work properly?

I'll go and test that.

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

Answer by Twistyd · Oct 13, 2018 at 09:09 AM

Ancient as this is I had the same issue, I resolved it by tagging the terrain. Sorry for the necromancy but if it can help someone else out then it's worth it.


TL|DR

It's not the trees!

Try using a tag on the terrain and then have the collision detection look for that tag, like so;

 void OnCollisionEnter (Collision other){
     // If the entering collider is a tree...
     if(other.gameObject.tag == "Tree"){
         Debug.Log ("Ow");
     }
 }

Initially I'd tried all I'd found online to try and fix it, I even tried tagging the trees with a Tree tag, re-prefabbing them, and then trying to repaint the re-prefabbed tree but nothing worked.

Last night I accidentally gave my terrain the Tree tag and boom, it worked, all sorted.

My collision code is:

 void OnCollisionEnter (Collision other){
 
     // If the entering collider is the enemy...
     if (other.gameObject.tag == "Enemy") {
         hit = true;
     }
 
     // If the entering collider is a tree...
     if(other.gameObject.tag == "Tree"){
         Debug.Log ("Ow");
     }
 }


My thinking is that the tree colliders, which are part of the terrain, are actually seen as the terrain. This might not be a workable workaround if you plan on having a character walk on the ground and receive damage if they hit a tree but might be useful for someone.

Hope it helps.

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

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

2 People are following this question.

avatar image avatar image

Related Questions

Making custom trees with animation work with unity terrain 0 Answers

Terrain tree colliders as triggers 2 Answers

Cannot place trees on terrain 0 Answers

Can't use tree brush tool 0 Answers

OnTriggerExit not called for Tree painted on Terrain 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