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 nagro · Apr 21, 2012 at 07:46 AM · games

How to create an invisible barrier?

Hello, I would like to create an invisible barrier and what has been behind this barrier because that is not only the "skybox", let me explain better. I want to create a spacecraft and put it behind the barrier that not only look to the pass it, so comes out as if he were invisible and appears from nowhere XD not be if I understood.

Resumido: create a barrier and of above there is not can't see(except the sky) but whatever is below if.

Because I want to create this bullshit? I want to create a game they invade us the aliens that ships will passing the barrier appeared as if they had been invisible and now appear

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 Flash · Apr 21, 2012 at 10:45 AM

You can check the position of your spacecraft and simply turn of the MeshRenderer when the spacecrafts position is behind the barrier. You could also change the opacity of the spacecraft through a shader.

The first method can be achieved with:

JAVASCRIPT

 var Barrier:Transform;
 
 function Update () {
     if(this.transform.position.z > Barrier.position.z){
         GetComponent(MeshRenderer).renderer.enabled = false;
     }
     else {
         GetComponent(MeshRenderer).renderer.enabled = true;
     }
 }

C#

 using UnityEngine;
 using System.Collections;
 
 public class SpaceCraftScript : MonoBehaviour {
 
     public Transform Barrier;
     
     void Update () {
         if(transform.position.z > Barrier.position.z){
             GetComponent<MeshRenderer>().enabled = false;    
         }
         else {
             GetComponent<MeshRenderer>().enabled = true;    
         }
     }
 }

If you wanna learn more about the second method try reading this:

http://forum.unity3d.com/threads/127396-Making-semitransparent-objects

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

How Can I Sell My Unity Game? 1 Answer

Distributing Free Games 0 Answers

Admob in Unity. 1 Answer

How do i make the tree model when your painting the terrain bigger? 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