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 ashjack · Jan 29, 2014 at 07:24 PM · c#javascriptcustomvoxel

Voxel Engine Coding Blocks?

Hi. I have recently got a voxel engine that I found on YouTube(Here) and I have worked out how to add blocks, and generate them in the world, but I didn't know how I would go about coding a block to do something. In this case, I would like to add a furnace that has a GUI, and the front texture changes when something is in it. I don't want a whole piece of code or anything, but snippets or pointers in the right direction would be a great help.

Thanks

AshJack.

Comment
Add comment · Show 10
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 HuskyPanda213 · Jan 29, 2014 at 07:57 PM 0
Share

$$anonymous$$ake the furnace gui on the player, and then activate it with Send$$anonymous$$essage, this will greatly optimize and reduce bugs.

I'm guessing you will use First Person, use raycasts sent from the player ins$$anonymous$$d of On$$anonymous$$ouseDown(), I found that On$$anonymous$$ouseDown does not work with the FirstPerson.

$$anonymous$$ake it that when the RayCast hit is there, there is a furnace tag as the hit's collider tag, and if Input $$anonymous$$ouse1 is clicked, the gui is active on the player, then give a Ienumarator, that times the furnace glow, by using sendmessage to a void on the furnace, and then the sentmessage-void triggerss the Ienum.

I hope that helps!

avatar image ashjack · Jan 29, 2014 at 08:11 PM 0
Share

Thanks for the reply. How do you think is best to create the GUI? By script or by GUITexture? Also, I have looked at the scene while the game is in play, and the game registers the chunks only, not each individual block, so I don't know how to make the furnace an exception to this rule.

avatar image HuskyPanda213 · Jan 30, 2014 at 04:08 PM 0
Share

I would make a general GUI Script. It contains the furnace, crafting and other ui and it would be on the player(rendering too much gui is not good, even if you cannot see it!).

Use sendmessage to activate it.

Also I know that chunks are how the world generates, but user-placed blocks are not chunks, right?

avatar image ashjack · Jan 30, 2014 at 04:35 PM 0
Share

Annoyingly, I thought that too, but a user placed block is added directly to the chunk. Thanks for the advice on GUI.

avatar image ashjack · Jan 30, 2014 at 04:59 PM 0
Share

I have found a file called Blocks.cs, and it registers some types of blocks, could I use this to find the furnace (It is called fireplace in the code):

 using UnityEngine;
 using System.Collections;
 
 public class Blocks {
 
     public const string Dirt = "Dirt", Grass = "Grass", Snow = "Snow";
     public const string Sand = "Sand", Stone = "Stone";
     public const string Water = "Water", Ice = "Ice", Fire = "Fire";
     
     public const string Wood = "Wood", Leaves = "Leaves";
     public const string Cactus = "Cactus", Pumpkin = "Pumpkin", Flower = "Flower", Fungus = "Fungus";
     
     public const string Bricks = "Bricks", TNT = "TNT", Fireplace = "Fireplace"; 
     
 }
   
Show more comments

0 Replies

· Add your reply
  • Sort: 

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

21 People are following this question.

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

Related Questions

press e to speek -1 Answers

Snow based questions 2 Answers

Need help converting Javascript to C# 3 Answers

Talking Code 2 Answers

Multiple Cars not working 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