Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by adrimat007 · Feb 21, 2016 at 04:27 PM · cameraplayerfollowsmooth

problem ghosting camera with 2 objets

Problem whit camera if there 2 objets in the same view.

The problem if whit the second objet that follow the player , it got like big ghosting ( more in mi monitor 144hz than in the video ) but u just need to compare when the camera hit a border and not.

code(probly there if reduntant):

 using UnityEngine;
 using System.Collections;
 
 public class CamController : MonoBehaviour {
     
     private GameObject target;  // jugador // The player
     
 
 
     //Objetos donde choca  //Collision objets Camera 
     private GameObject TopWall;
     private GameObject DownWall;
     private GameObject LeftWall;
     private GameObject RightWall;
 
     private float TopY;
     private float DownY;
     private float LeftX;
     private float RightX;
 
     private Vector3  offset;
     
     void Start () {
         
         
 
         // medidas de distancia minima muros // Object and Distances Test
         target = GameObject.Find("Player_0");
         TopWall = GameObject.FindGameObjectWithTag("Top");
         DownWall = GameObject.FindGameObjectWithTag("Down");
         LeftWall = GameObject.FindGameObjectWithTag("Left");
         RightWall = GameObject.FindGameObjectWithTag("Right");
 
         TopY = TopWall.transform.position.y - 1.8f; 
         DownY = DownWall.transform.position.y + 1.9f; 
         LeftX = LeftWall.transform.position.x + 3.2f; 
         RightX = RightWall.transform.position.x - 3.2f; 
 
       
         offset = new Vector3(0f, 0f, -10f);
     }
     
     void Update () {
         
     }
     
     
     void LateUpdate()
     {
         // Camera.main.orthographicSize = Screen.height / 2 * 1 / 128; 
 
         if (target.transform.position.y > TopY)
         {
             if (target.transform.position.x < LeftX)
             {
                 transform.position = new Vector3(LeftX, TopY, -10f);
             }
             else if (target.transform.position.x > RightX)
             {
                 transform.position = new Vector3(RightX, TopY, -10f);
             }
             else
             {
                 transform.position = new Vector3(target.transform.position.x, TopY, -10F);
             }
         }
 
         else if (target.transform.position.y < DownY)
         {
             if (target.transform.position.x < LeftX)
             {
                 transform.position = new Vector3(LeftX, DownY, -10f);
             }
             else if (target.transform.position.x > RightX)
             {
                 transform.position = new Vector3(RightX, DownY, -10f);
             }
             else
             {
                 transform.position = new Vector3(target.transform.position.x, DownY, -10f);
             }            
         }
         else  if (target.transform.position.x < LeftX)
         {
             transform.position = new Vector3(LeftX, target.transform.position.y, -10f);
         }
         
 
         else if (target.transform.position.x > RightX)
         {
             transform.position = new Vector3(RightX, target.transform.position.y, -10f);
         }
         else
         {
             transform.position = target.transform.position+ offset ;
         }        
     }
 }

Here a video ; https://www.youtube.com/watch?v=gWls9RCxSFY&feature=youtu.be

Thx, and sorry my bad english :)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

My model is shaking 0 Answers

Camera Follows 2D player 0 Answers

Camera Following [2D] 2 Answers

moving the camera smoothly to players current position in unity 2 Answers

How to make a Camera follow an object and then distance itself from the object when a button is held down? 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