Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Muzz5 · Jun 05, 2011 at 07:59 PM · terrainheight

Edit Terrain via scripting

Is it possible to lower the terrain without going in to the terrain editor and using the brush? I want to lower it where there is a mesh. I know it is possible - I'm just not sure where to start! Any advice is appreciated.

Comment
Add comment · Show 5
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 RetepTrun · Jun 05, 2011 at 09:26 PM 0
Share

I saw a youtube video of a $$anonymous$$ing game where they did it (so at least its possible). Theres something tricky about it though because terrains are a height map.

avatar image Peter G · Jun 05, 2011 at 09:35 PM 0
Share

Just curious, is this an editor script or a runtime thing?

avatar image RetepTrun · Jun 05, 2011 at 10:32 PM 0
Share

Here I found that video I was thinking of

http://www.youtube.com/watch?v=4A$$anonymous$$vYngbPbE

avatar image Muzz5 · Jun 06, 2011 at 04:56 AM 0
Share

This is an editor script. Ever used EasyRoads from the Asset Store? There is a free version online. That allows you to change terrain at a mesh (I think).

avatar image RetepTrun · Jun 06, 2011 at 01:59 PM 0
Share

Yea easyroads is fun, it lays out a benzer curve road mesh and flattens any terrain beneath it. $$anonymous$$y brother and I have a pretty crazy racecourse. There's an easy rivers too.

Have you tried decifering the scripts from those, and copy-pasted from them? I bet you have already :-)

1 Reply

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

Answer by ckfinite · Jun 05, 2011 at 11:16 PM

Terrain is made using a heightmap, and you can alter it through this: http://unity3d.com/support/documentation/ScriptReference/TerrainData.html

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 Muzz5 · Jun 06, 2011 at 04:56 AM 0
Share

I can do google searches too. I got that far.

avatar image ckfinite · Jun 06, 2011 at 05:04 AM 1
Share

Okay, it sometimes just seems like some people don't know how on here. Anyway, what I would do is I would find the Vector3 distance from the terrain's origin to the affector mesh, then map that into terrain heightmap space by dividing the distance by heightmapScale. Then I would round the x and z to an int, and that should be your affected heightmap coordinate. I would recommend then using something like SmoothStep to apply that smoothly to the surrounding coords.

This is a untested by me technique, so the details might be wrong, but the overall system should work.

avatar image gsoft9999 · Apr 03, 2013 at 09:48 AM 0
Share

will the changes done by script change the terrain for ever or till the end of the current game?

avatar image gilley033 · May 03, 2013 at 03:14 AM 1
Share

I haven't tested it, but according to the docs, any game time changes to terrain data will be permanent.

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

6 People are following this question.

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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Incorrect height with sampleHeight 1 Answer

the save heigts of the terrain during the game? 0 Answers

Max Height Of Mountains 2 Answers

Best way to get terrain positions from a given height range 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