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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by TaylorAnderson · Aug 01, 2012 at 06:00 PM · cameraissueflickering

Camera flickers between scenes

So I have a camera that moves forward by set increments every time my player leaves its viewport. It works fine, except if I get my player to stand just between one viewport and the new one, the camera flickers between the two scenes. Is there a way to fix this? I have a way to set scripted camera scenes too, and those don't experience the same flickering because I set them manually, and I have a one-way barrier that doesnt allow the player to go back once they've entered a scripted scene.

 using UnityEngine;
 using System.Collections;
 
 public class CameraScript : MonoBehaviour 
 {
  private bool isScripted=false;
  private int sceneNumber=0;
  public Transform target;
  void Update() 
  {
  //this sets the left and right border to whatever the camera can see on the left and right sides
  Vector3 rightBorder=camera.ViewportToWorldPoint (new Vector3(1,1,1));
  Vector3 leftBorder=camera.ViewportToWorldPoint (new Vector3 (0,0,0));
         
  //this makes it so that if the player hits the left or right border, the camera moves over to compensate.
  if (target.transform.position.x >= rightBorder.x && isScripted==false)
  {
  transform.position=new Vector3 (rightBorder.x + 7f, transform.position.y, transform.position.z);
  sceneNumber++;
  }
  
  
  if (target.transform.position.x <= leftBorder.x && isScripted==false)
  {
  transform.position=new Vector3 (leftBorder.x - 7f, transform.position.y, transform.position.z);
  sceneNumber--;
  }
  
  if (sceneNumber==2)
  {
  isScripted=true;
  transform.position=new Vector3 (34f, -6f, -10f);
  camera.orthographicSize=10;
  }
  
 
  }
  
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by TaylorAnderson · Aug 07, 2012 at 07:29 PM

i think im just going to drop the code and make it more scripted instead. thanks for the help

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

Answer by ScroodgeM · Aug 01, 2012 at 09:25 PM

just added 1 word 8)

using UnityEngine; using System.Collections;

public class CameraScript : MonoBehaviour { private bool isScripted=false; private int sceneNumber=0; public Transform target; void Update() { //this sets the left and right border to whatever the camera can see on the left and right sides Vector3 rightBorder=camera.ViewportToWorldPoint (new Vector3(1,1,1)); Vector3 leftBorder=camera.ViewportToWorldPoint (new Vector3 (0,0,0));

//this makes it so that if the player hits the left or right border, the camera moves over to compensate. if (target.transform.position.x >= rightBorder.x && isScripted==false) { transform.position=new Vector3 (rightBorder.x + 7f, transform.position.y, transform.position.z); sceneNumber++; }

else if (target.transform.position.x <= leftBorder.x && isScripted==false) { transform.position=new Vector3 (leftBorder.x - 7f, transform.position.y, transform.position.z); sceneNumber--; }

if (sceneNumber==2) { isScripted=true; transform.position=new Vector3 (34f, -6f, -10f); camera.orthographicSize=10; }

}

}

Comment
Add comment · Show 4 · 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 TaylorAnderson · Aug 01, 2012 at 09:51 PM 0
Share

THAN$$anonymous$$ YOU.

avatar image ScroodgeM · Aug 01, 2012 at 10:13 PM 0
Share

accept answer if it O$$anonymous$$ to close question

avatar image TaylorAnderson · Aug 07, 2012 at 03:22 AM 0
Share

i just tried building the game, and with the extra black space on either side the camera flicker gets really bad, even with the one word added. ideas?

avatar image ScroodgeM · Aug 07, 2012 at 07:19 PM 0
Share

i don't clearly understand what type of flickering you are talking about. explain please. images will be the best.

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

7 People are following this question.

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

Related Questions

How to fix weird camera rotation? 0 Answers

Mathf.Clamp issues 1 Answer

,iOS WebCamera Texture GetPixels() call returns only black colours? 1 Answer

Terrain lighting flickering glitch 1 Answer

Part of mesh disappears on certain rotation angles in first person. 2 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