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 minas1 · Oct 07, 2013 at 08:29 AM · colliderterraintree

Trees collide but says collided with terrain

So I added some trees to my terrain using the mass tree tool. I had already created a prefab for my tree and added a capsule collider to it.

So I edited the settings of the trees for the terrain and set it to use that prefab.

Note that the prefab has the tag Tree and the terrain has the tag Ground.

However when the player collides a tree, the log says it collided with the terrain, not with tree (I print the tag of the collider's gameobject). I don't want this behaviour because I do things depending on where the player hit. Is it possible to fix this?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GwenoleGerard · Oct 07, 2013 at 09:45 AM

,Do you use different Layer for your trees and your terrain ? If you don't you can try this:

In Edit->project settings->Tag you can add Layer, create one for the tree and one for the ground for example.

Then in your tree prefab change the Layer (top right in the inspector) for the Layer you create for the tree. Do the same with your terrain with the appropriate layer.

Then in Edit->project settings-> physics you can choose which layer collide with tree Layer and Terrain Layer.

You can also add a script with the method OnCollisionEnter(Collision collision) and in this method add the condition if(collision.tag == tagYouWant) or if(collision.tag != tagYouDontWant).

Comment
Add comment · Show 1 · 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 AlucardJay · Apr 28, 2015 at 05:53 AM 0
Share

The OP is referring to the trees as part of the terrain system, not as separate gameObjects. Therefore there is no way to distinguish a tree collider from a terrain collider; layers, tags, nothing.

See various other posts regarding the terrain and treePrototypes data :

  • http://answers.unity3d.com/questions/685405/mass-place-trees-tagging.html

  • http://answers.unity3d.com/questions/650308/how-do-i-interact-with-terrain-trees.html

avatar image
0

Answer by minas1 · Oct 07, 2013 at 01:17 PM

I found the answer. I move the player using translate (not velocities), so it is not detected. I'll have to change it.

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

16 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

Related Questions

Disabling colliders in Terrain Trees? 1 Answer

Tree Colliders not working 1 Answer

Colliding with trees using mesh colliders 1 Answer

CreateTerrainGameObject not creating tree colliders? 1 Answer

Destroy Terrain Trees And They 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