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 CubePhysics · Feb 23, 2013 at 06:46 PM · instantiateterraingamevoxelstrategy

Need help with strategy terrain.

Hey guys, got a question here ill be glad if you can help. Im making a strategy game like Stronghold 2.I want to create a sort of terrain that lets you build, instantiate prefabs on it and doesnt instantiate prefabs when the terrain looks is uneven just like Stronghold 2. Im not sure whether I have to create a voxel terrain which i really dont know how to do. Can someone help please. Thanks

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
0

Answer by Kiloblargh · Feb 23, 2013 at 07:36 PM

You shouldn't need a voxel terrain for a traditional strategy game, that would be more for something like if you were making a 3d version of Worms.

You need a ghost building that follows the cursor, can turn red or green, and while it is moving you need to check every terrain vertex in the the building's footprint against its neighbors and if the slope is greater than a certain point, or the overall slope corner-to-corner is above a certain value, then you can't build, if all of them are less, then you can build.

[edit] Actually, you don't need to compare verts directly, if your terrain will not change during the game. I've been working on my own dynamic terrain and haven't actually used Unity's terrains, but they give you a lot of useful functions to work with. Check this one out:

http://docs.unity3d.com/Documentation/ScriptReference/TerrainData.GetSteepness.html

It's going to be a lot of scripting to get the building placement effects fully working the way you want and you're probably not going to get someone to write it for you on this site, so crack open the docs and get to reading.

Comment
Add comment · Show 2 · 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 CubePhysics · Feb 23, 2013 at 07:40 PM 0
Share

Thanks allot! what sort of docs shall I read though to help me with this

avatar image Kiloblargh · Feb 23, 2013 at 07:47 PM 0
Share

Everything having to do with TerrainData, and Transform, and Colliders, and Raycasts. Once you get to the issue of placing buildings next to other buildings or on top of moveable units, might want to use something like: http://docs.unity3d.com/Documentation/ScriptReference/Physics.OverlapSphere.html

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

9 People are following this question.

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

Related Questions

Instantiating multiple objects, Destroying and instantiating on trigger + delay 0 Answers

Instantiate trees on terrain with perfect height. 2 Answers

Making a particle effect parallel to the slope of a terrain 1 Answer

Flowing water in my voxel terrain 1 Answer

How to make a voxel terrain generate all around the start point 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