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 tbaron · Apr 01, 2012 at 12:05 AM · setheights

SetHeights to a Negative

I'm creating a procedurally generated landscape. I can use the SetHeights function to increase the height of the terrain, creating mountains and ridges. I want to also create depressions in the terrain, but unfortunately SetHeights isn't accepting negative numbers for the heights array. For instance, in SetHeights(x,y,z[,])--if z has any negative numbers in it, they do not affect the heightmap.

I suspect this is because the heights array is suppose to be populated with numbers in the range of 0 to 1. If that's the case, how do I go about creating a depression in the terrain?

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

1 Reply

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

Answer by Eric5h5 · Apr 01, 2012 at 12:58 AM

You just make the baseline height something above 0. If the baseline is .5, then anything above that is raised and anything below it is a depression.

Comment
Add comment · Show 4 · 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 tbaron · Apr 01, 2012 at 02:59 PM 0
Share

Thanks for the quick response! How do you set the baseline height? I'm looking through the TerrainData functions and variables, and I can't seem to find it there.

avatar image Eric5h5 · Apr 01, 2012 at 04:07 PM 0
Share

It's nothing you set, it's just something you assume. If you decide "O$$anonymous$$, the baseline should be .5", then it's .5.

avatar image tbaron · Apr 02, 2012 at 06:03 PM 0
Share

This might not be what you meant, but I've found a solution. First, I set the whole heights array to .5, and then after that I set the elevations to floats greater than .5 and depressions to floats lower than .5. Works like a charm!

avatar image Bunny83 · Apr 02, 2012 at 06:11 PM 1
Share

@tbaron: That's exactly what he meant ;)

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

Getting a GameObjects position in relation to a Terrains Resolution 1 Answer

terraindata.setheight as a brush for runtime terrain editing 1 Answer

Why _terrainData.SetHeights() resizes the terrain? 0 Answers

Issue copying heightmaps from a LARGE terrain to a new, small, cutout Terrain with GETHEIGHTS and SETHEIGHTS 2 Answers

Problems with Translating Java in C# 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