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 KhanTyranitar · Jun 01, 2015 at 01:03 PM · backgroundstarsgrids

Trying to create grid background and star field

I am working on a game in which I need to have an overhead camera facing down on a ship. I need to have a grid that is drawn that provides a point of reference. The grid needs to not follow either the camera or the player, but rather as a backdrop. Since the ships can travel at considerable speeds and go considerable distances, the grid needs to be able to be either infinite, or at least very large (I could impose a limit on how far the player can go.

Also I need to dynamically generate a star field in the background, I imagine the technique would be similar, it would just be some distance behind the grid layer, and they would probably be multiple star field layers to create a parallax effect.

I'm not sure how to go about this.

I consider myself to be a novice at coding.

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 KubaPrusak · Jun 01, 2015 at 04:45 PM

You can fill the camera view with textures of a grid that tessellate. Then you can use this function OnBecameInvisible() Documentation Link to see when the object goes outside the screen. When it does go outside in the BecomeInvisible you can move its position so that when the player moves in a direction the grid is there.

For example

If player is moving right

 function OnBecomeInvisible()
 {
 if (direction == "right")
 {
 this.gameobject.transform.translate(value that will make it go on the other side of the screen to tesselate);
 }
 }
 

This script would go on the grid texture gameobject.

Comment
Add comment · Show 1 · 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 KhanTyranitar · Jun 04, 2015 at 08:23 AM 0
Share

That may work. Now I have to figure out how to display and configure a grid. I'm not sure I want the grid to be a texture though, because if it is, then at differing zoom levels, and on screens with differing resolutions, it might look funny. I'm sure Unity supports what I'm trying to do, I'm just not sure how to do it.

In my game, the camera scrolls with the player, but without some type of backdrop and reference, you really have no bearing on speed or distance. I want to be able to zoom the camera in and out, and the grid provides the visual reference for speed and scale.

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

Background Image as Orthographic 2D Game Background - and quick 2D parallaxing question 1 Answer

Scrolling Background 1 Answer

2d environment with 3d Characters 0 Answers

Endless runner game on a mobile platform for a beginner ? 3 Answers

Does unity have a feature that lets you change something in one scene from a completely different scene? 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