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 DavidDebnar · Jul 14, 2011 at 07:10 AM · mesharrayproceduralminecraftid

Most efficient method to create mesh from array

Hey guys. I was wondering, that what is the most efficient method to generate mesh from array? Because instantiating is damn slow. So I thought that I could just store the cubes data in 3D array like 0 - air, 1 - block, but how can I easily make a mesh from that? And yes I checked the minecraft and after playing minecraft, but I couldn't understand what's going on, because it was really complex, and I would need to get only the roots first to understand.

The code is bit messy but will give the idea.

//initalization
//creating cube from many cubes, than if it's in radius/distance*2 it's 0-air,
//if it's in radius it's 1-dirt
//if it's in radius-5 it's 2-stone
//I store it into a 3d array named planet
//here should I rebuild the mesh from the array I have.
//than if raycast and mouse -- set the block id to 0--air/destroy it 

I haven't posted the whole code, because it's just while(x

--David

Comment
Add comment · Show 21
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 biohazard · Jul 14, 2011 at 08:01 AM 0
Share

You should post the code anyway, it makes helping and unerstanding easier

avatar image DavidDebnar · Jul 14, 2011 at 08:49 AM 0
Share

look the code was simple algorithm like while(x

avatar image biohazard · Jul 14, 2011 at 08:51 AM 0
Share

ever thought of making this in java?

avatar image DavidDebnar · Jul 14, 2011 at 09:05 AM 0
Share

lol no :D I don't know java. I know that Notch made $$anonymous$$inecraft in java, but he just copied the content of infinite$$anonymous$$er or how is it called :D. And I don't wanna make a $$anonymous$$ecraft style game, I wanna make something more science-fiction.

avatar image biohazard · Jul 14, 2011 at 09:09 AM 0
Share

Notch was inspired by infini-$$anonymous$$er, but $$anonymous$$ecraft itself is ten thousand times better and has a lot of better features

Show more comments

1 Reply

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

Answer by Eric5h5 · Jul 14, 2011 at 08:46 AM

You wouldn't instantiate cubes, you'd use the Mesh class to create meshes.

Comment
Add comment · Show 6 · 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 DavidDebnar · Jul 14, 2011 at 08:58 AM 0
Share

yeah I know, that's why I'm not instantiating anymore :D, it's in the comment above. Uhm. $$anonymous$$aybe some help? Because first I thought about combining the children, but even the instantiating was slow, so I would never get to the children. So I should just create the mesh from the array like every piece in array is a cube or what?

avatar image Eric5h5 · Jul 14, 2011 at 09:11 AM 0
Share

You would create the vertices, triangles, etc. directly.

avatar image DavidDebnar · Jul 14, 2011 at 09:17 AM 0
Share

But how can I export the array? For instance I only want the faces, that are visible/next to air and player can see them, so maximum up to 3 faces, because you can't see more faces of cube. And I forgot, how can I make some cubes look different, like dirt/stone etc? Sorry for asking too much, but I'm new to meshes :).

avatar image DavidDebnar · Jul 14, 2011 at 10:22 AM 0
Share

bump

avatar image DavidDebnar · Jul 14, 2011 at 02:35 PM 0
Share

ok I made it... But I still have a big problem, that Vector3.Distance is really slow, when I wanna make it for many cubes. :(

Show more comments

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

Does a Mesh Vertices/Triangles/etc Have to be Compact 1 Answer

Generate a mesh from randomly positioned points 0 Answers

Procedural Mesh Generation - Split Arrays into sections 1 Answer

Procedurally generated mesh JS - explain the error please 0 Answers

Generate mesh from raycast positions, independent of rotations 0 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