• 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 francisliardet · Dec 02, 2011 at 09:24 AM · terraindetectiontree

Interacting with individual trees on terrain

Hi, I'm creating a survival type game with unity and my aim is to have each tree on my map able to be cut down or interacted with.

I was wondering if there was some sort of way to tag trees or reference a collision between a tree and a player via script. The tree doesn't necessarily have to be physically cut down, but I need some way of telling how many times a player has hit the trunk.

The trees I am talking about have been added via the Terrain editor and I would like to keep it that way if possible. I would rather not individually add each tree to the world map :P

Thanks in advance, Francis

Comment
Add comment · Show 1
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 smartinis · Apr 05, 2016 at 06:17 AM 0
Share

@francisliardet what issues did you start having with collider physics?

1 Reply

· Add your reply
  • Sort: 
avatar image
-1

Answer by francisliardet · Dec 03, 2011 at 11:19 PM

Ok well I figured out this one on my own :P What I did was I made prefabs of each of the trees I wanted to use, I put colliders on them, tagged them as "tree', added them as new trees in the terrain editor, placed them, and then finally wrote a script to show when two certain colliders touched, i.e. axe and tree.

Comment
Add comment · Show 5 · 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 Exagerate · May 28, 2013 at 06:25 PM 0
Share

Fancy sharing this script, or parts of it? :D

avatar image Kirbyrawr · Jun 06, 2013 at 01:20 AM 0
Share

http://answers.unity3d.com/questions/459765/tree-chopping-script-issues.html

avatar image francisliardet · Jun 06, 2013 at 04:30 AM 0
Share

Yeah, I'd suggest following that link, raycasting is the way to go. I ended up changing it from what I said above because I started to run into problems with collider physics.

avatar image iamjinge · Sep 21, 2016 at 03:06 AM 0
Share

how to get the tag of the tree?

avatar image getyour411 iamjinge · Dec 05, 2016 at 07:17 PM 0
Share

The approach written here does not work at all for a Terrain tree; the OP must have changed to using GameObject trees.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

Upgraded to Unity 3 and now my trees are acting odd. 2 Answers

Detect Different Terrain Texture? 2 Answers

Cannot paint non-default trees 0 Answers

Placing tree objects with Terrain or Polybrush which one is useful ?? 0 Answers

Disabling colliders in Terrain Trees? 1 Answer


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