• Unity
  • Services
  • Made with Unity
  • Learn
  • 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
  • Forums
  • Answers
  • Feedback
  • Issue Tracker
  • Blog
  • Evangelists
  • User Groups

Navigation

  • Home
  • Unity
  • Industries
  • Made with Unity
  • Learn
  • Community
    • Forums
    • Answers
    • Feedback
    • Issue Tracker
    • Blog
    • Evangelists
    • User Groups
  • Get Unity
  • Asset Store

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 unity_4nxsOi3-5VVdug · Jan 08 at 10:04 AM · howhow to

I don't want the blues coming out when the camera follows the player.,how do I destroy the blue background in my camera tracking

Hi ı'm new unity user. I don't want to see the blue in the back when the camera follows the player. While my game is playing the camera goes right down. and Cameram follows my player. But I don't want the background blues to appear. I would appreciate it if you could help. alt text

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class kamer : MonoBehaviour {

 public Transform player;
 public Vector3 offset;

 void Update () 
 {
     transform.position = new Vector3 (player.position.x + offset.x, player.position.y + offset.y, offset.z); // Camera follows the player with specified offset position
 }

} ,Hi , im new to unity and using unity. the player has the following camera. I don't want the background blue to appear when playing games and watching the camera player. I would appreciate it if you could help. alt text

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class kamer : MonoBehaviour {

 public Transform player;
 public Vector3 offset;

 void Update () 
 {
     transform.position = new Vector3 (player.position.x + offset.x, player.position.y + offset.y, offset.z); // Camera follows the player with specified offset position
 }

}

adsız.png (230.4 kB)
adsız.png (230.4 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

1 Reply

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

Answer by Hellium · Jan 08 at 10:11 AM

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class kamer : MonoBehaviour
 {    
      public Transform player;
      public Vector3 offset;
       // Specify the min and max position of the camera:
       // x = min value on x axis
       // y = min value on y axis
       // z = max value on x axis
       // w = max value on y axis
      public Vector4 bounds;
      void Update () 
      {
          // Camera follows the player with specified offset position
          transform.position = new Vector3 (
              Mathf.Clamp( player.position.x + offset.x, bounds.x, bounds.z ),
              Mathf.Clamp( player.position.y + offset.y, bounds.y, bounds.w ),
              offset.z
          );
      }    
 }





Comment
Add comment · Show 8 · 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 unity_4nxsOi3-5VVdug · Jan 08 at 10:37 AM 0
Share

I tried but the camera does not move.

avatar image Hellium unity_4nxsOi3-5VVdug · Jan 08 at 11:04 AM 0
Share

Are you SURE you have specified correct values in the bounds variable?

(Obviously, bounds.z must be greater than bounds.x and bounds.w must be greater than bounds.y)

avatar image unity_4nxsOi3-5VVdug · Jan 08 at 04:31 PM 0
Share

I'm new and I don't understand how to write the boundaries. I would appreciate if you write a sample.

avatar image Hellium unity_4nxsOi3-5VVdug · Jan 08 at 04:54 PM 0
Share

As I indicated in the code, you have to change the values of the Boundaries vector to prevent the camera from going too far to the left / the right. YOU have to choose the values according to your level.

  • X is the LEFT boundary (`-2` for instance)

  • Y is the BOTTOM boundary (give it a negative value like -999999 if your player goes downwards)

  • Z is the RIGHT boundary (`2` for instance)

  • W is the TOP boundary (`50` for instance)

avatar image unity_4nxsOi3-5VVdug · Jan 08 at 04:36 PM 0
Share

but it works. the camera is not going downwards. my game is a downward game.

avatar image unity_4nxsOi3-5VVdug · Jan 08 at 04:38 PM 0
Share

alt text

What should I do?

ads12.png (250.3 kB)
avatar image unity_4nxsOi3-5VVdug · Jan 08 at 04:46 PM 0
Share

bu sefer başardım çok teşekkür ederim. :)

Show more comments

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

170 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

Related Questions

Unity opens but it won't show anything?,Unity opens , but it doesn't show anyting? 0 Answers

i want my sphere character launched to the air when he hits collider. how to do this? 0 Answers

I need your help for SaveLoad method. 1 Answer

[C#] Enum not working properly 2 Answers

How can i make dynamic terrain for car game? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges