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 ATLGAN · May 27, 2021 at 08:15 AM · camerasceneloopcamera-look

How to make horizontal scene loop like JumpDown?

I'm trying to make the lines on the stage loop like in the JumpDown game. For this, I set limits according to the size of the screen and check the positions of the objects, this actually works, but it is a bit costly to do this for each object and I have performance problems because there are more than 200 objects on the stage that I need to check. Other than that, if the frame drops, objects can lose control.

 private void Update()
     {
         if (work)
         {
             left_position = c_transform.position - c_transform.forward * (c_transform.localScale.z / 2 + left_position_offset);
             right_position = c_transform.position + c_transform.forward * (c_transform.localScale.z / 2 + right_position_offset);
 
             left_screen_position = camera.WorldToScreenPoint(left_position);
             right_screen_position = camera.WorldToScreenPoint(right_position);
 
             if (right_screen_position.x > 0 && left_screen_position.x < Screen.width)
             {
                 inside = true;
             }
 
             if (right_screen_position.x < 0)
             {
                 if ((right_object.right_position - spawn_right).magnitude >= minimum_distance)
                     WentOutOfLeft();
             }
             if (left_screen_position.x > Screen.width + 0)
             {
                 if ((left_object.left_position - spawn_left).magnitude >= minimum_distance)
                     WentOutOfRight();
             }
         }
     }
     private void WentOutOfRight()
     {
         if (inside)
         {
             inside = false;
             MoveToLeft(left_screen_position);
         }
     }
     private void WentOutOfLeft()
     {
         if (inside)
         {
             inside = false;
             MoveToRight(right_screen_position);
         }
     }
     private void MoveToRight(Vector3 _right_screen_position)
     {
         spawn_right.y = transform.position.y;
         Vector3 spawnPos = spawn_right;
         spawnPos.x += c_transform.lossyScale.x / 2;
         c_transform.position = spawnPos;
     }
     private void MoveToLeft(Vector3 _left_screen_position)
     {
         spawn_left.y = transform.position.y;
         Vector3 spawnPos = spawn_left;
         spawnPos.x -= c_transform.lossyScale.x / 2;
         c_transform.position = spawnPos;
     }

I am trying another method other than that. I'm putting two cameras side by side. One of them is base and the other is overlap. In this way, when I slide a single object to one side of the screen on the scene, it feels like there are two objects because the other camera renders it. This method is a very optimized method compared to the other, but the problem here is that the player must always be in the middle of the camera. Since there are two cameras, the actor appears on the object in one camera, but actually he is not there: alt text

As a result, how can I make a system like in JumpDown game?

resim-2021-05-27-111324.png (64.0 kB)
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

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

200 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Unity3D] Game Scene and Making Scene is different 1 Answer

Camera Issue: Camera Icon and box not visible in scene view 0 Answers

How to lock my camera in one direction 1 Answer

Simple Camera ZoomIn Out Script 1 Answer

Camera movement similar to World of Guns 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