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
1
Question by Valleriani · Feb 04, 2014 at 03:18 PM · rotationbackgroundskybox

Scrolling Skybox with a 2D space shooter

I'm developing a space shooter, 2D top down.

I have two cameras, one main and one background. The main camera is rendering everything but the background itself, having a depth of -1, and is orthographic. Clear flag is 'depth only' The background camera, I'm using a perspective camera (Not sure if this is right but looks better atm.), depth of -2, only renders the background itself.

My camera follow script and background follow script is this, attached to the main camera is this:: if (target)

 {


     Vector3 point = camera.WorldToViewportPoint(target.position);


     Vector3 delta = target.position - camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, point.z)); //(new Vector3(0.5, 0.5, point.z));


     Vector3 destination = transform.position + delta;


     destination.y = 10; 


     transform.position = Vector3.SmoothDamp(transform.position, destination, ref velocity, dampTime);


     if (bgCamera)


     {


         bgCamera.transform.eulerAngles = new Vector3(-transform.position.z % 360, transform.position.x % 360, 0.0f);


     }


 }

bgCamera being the background camera. Target is the space ship.

Now, traveling 'one direction' seems to work (even though it feels like it's in a sphere, but that's another issue), but when mixing in both it gives a wierd look, the angle gets all wierd. I've supplied a youtube video to show it. First one is flying straight up, works okay, then flying left, works okay.. Mixing in both, doesn't work.

https://www.youtube.com/watch?v=jnSYS39QA0U

Overall I'm not sure if the skybox is the best approach or if there is a better idea. I 'really' like the skybox program I am using right now as it generates very nice skyboxes. But I want the background to seem 'endless' and skyboxes seem like a way to go.

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 Conroy100 · Dec 09, 2014 at 01:48 AM

I am having the exact same problem, however, i'm only using a skybox image on my +z plane which always flollows the main camera, and a sphare particle system that follows the player and rotates in the opposite direction of the player. i don't know how to fix it, but i'm wondering if i could just create a flat particle system that follows the player, creates new particles on the edge of the player field of view, then destroys particles that are too far from the players perspective.

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

20 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

Related Questions

A node in a childnode? 1 Answer

Rotation problem 1 Answer

Minimum distance on configurable joint? 2 Answers

2D Game - Y axis rotation (left - right) 2 Answers

Is possible to keep running code in phones while application is backgrounded? 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