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 hadderz84 · Jun 28, 2014 at 08:27 PM · terraincolliderstrees

How can I have mass amount of tress without performance loss?

Hello everyone, I'm currently working a project where I would like to place a mass amount of trees with colliders and use my raycast to detect whether or not the player is looking at the tree or not. I done some research on this and found i would have to write a script that adds colliders to each tree during run time but only in Java not C#. Does this effect performance or do you guys know of a different way this can be accomplished without taking a massive hit in performance? Any info would help. thanks in advance. Oh and one thing I know about the prefab method but unity likes to turn all colliders from the tree to one terrain coliider which then returns back that the player is looking at the ground not the tree.

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 iwaldrop · Jun 29, 2014 at 09:00 PM 0
Share

A single raycast forward isn't all that expensive. What concerns about performance do you have?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bloodyem · Jun 29, 2014 at 04:00 PM

Hmmm...raycasting by itself can get pretty pricey as far as performance. Do you need them to be in any particular order? You could possibly create a work around where you use static particles to place the trees...I'm not sure, I'll look it up and edit, but it seems like that might be a decent bet.

EDIT Yes, you can add colliders to particles. This ought to at least make placing them quick and easy, but it still may affect performance, depending on the poly count.

GameObject->Create Other->Particle System

Component->Particles->World Particle Collider

Then set the particles to be meshes and load up your tree mesh into 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
avatar image
0

Answer by getyour411 · Jun 30, 2014 at 06:17 AM

Regarding this

"Oh and one thing I know about the prefab method but unity likes to turn all colliders from the tree to one terrain coliider which then returns back that the player is looking at the ground not the tree. "

the workaround for that is to compare the raycast hit .y vs the terrain SampleHeights at the same location; if the .y is a bit higher, the raycast/player is looking at a tree, not the terrain.

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Removing colliders from terrain trees 2 Answers

Scripts on Terrain Trees 2 Answers

How to disableTerrain Collider but keep the Tree Colliders? 1 Answer

Disable collider on only 1 tree type not all? 1 Answer

Terrain tree colliders as triggers 2 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