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
1
Question by coolranchdoritos · Oct 10, 2011 at 01:22 AM · c#terraincoordinates

Gather all coordinates of a terrain into a data structure.

I'm having a hard time getting this started, so how should I begin this process? I need it for easy placement of objects on the map using code.

I'm using C# as the scripting language, so do I create a blank script and have it gather coordinates that way? I guess i'm having a hard tim conceptualizing how I even begin this process.

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 syclamoth · Oct 10, 2011 at 01:24 AM 0
Share

Terrain.terrainData would be a good place to start! However, for this kind of thing I would do it on a case-by-case basis- whenever you wanted to place an object, raycast onto the terrain, and then use hit.point to find out the location of that specific spot.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by coolranchdoritos · Oct 10, 2011 at 08:10 PM

Thanks, Terrain.terrainData seems to have some pretty useful functionality.

C# is very foreign to me, but in general for beginning the task, I'm assuming I should start a loop at the position (0,0,0), increase x until it reaches the far side of the terrain - then reset x to 0, and increase y by 1. (like reading a book!) Continue this pattern until y reaches the end and finish the loop.

Yet with C# being a blur to me, what structure should I use for this? I'll eventually need to be able to place objects onto the terrain like object.placeOnTerrain(x,y,z); Thanks for any additional input. I need the help!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Two exact objects behaving differently... *scratches head* 0 Answers

Error whit c# code 'UnityEngine.Transform.position' because it is not a variable. 1 Answer

Collider doesn't transfer to function 1 Answer

A problem with intersection detection 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