Wednesday, 15 November 2017

PIP effect unity android game development

PIP (Picture in Picture) Effect
Picture in picture effect means creating a map using a second camera. The second camera will be a miniature screen which is place in the first camera. The first camera has a screen which is the main screen. The pip effect is applied to multi-player game where two players will be using one screen in a game scene. Each player gets his own portion of the screen. A very good example where the pip effect is applied is a car racing game. If the car is about to revised another screen which serve as a mirror will be display. In this example, we will be using a character controller. As you already know, a character controller has its own main camera. What we are about to do is to make a miniature camera be place in the character controller main camera. We start by importing the character controller
1.      Click on assets from the tool bar
2.      Click on import package
3.      Click on the character controller
4.      Click on import
5.      Drag character controller to your terrain





The above image shows you how a PIP looks like. At the top right corner, you can see another picture which can serve as a map or can see game objects faster, before i can see it. This process is known as a PIP effect.

Note: when dragging any game object or game assets to a terrain, make sure that you position your Gizmos in the x and y direction. Wrong positioning of any game object or assets might lead to wrong movement. Meaning instead of using the “up” directional key to move upward to the z direction, you might experience your game object moving to another direction.

In this example, we shall be using a first person character controller in the game scene. The next thing is to add the miniature camera. To make things simple, first double click on the first person character controller from the hierarchy view and
1.      Click on the game object
2.      Click on create others
3.      Click on camera




After positioning your camera to view your desire portion of the screen, make the character controller to be a parent to the camera. Click on the camera and change the ViewPortRect to the following
X= 0.75                            Y=0.75
W = 0.2                            H = 0.2
You can play with the digit to see how it works. Also, you can change the field of view from the inspector view to 45 or any desirable figure. Change the depth of the camera to 0 and the depth of the first person character controller to -1. This is because the camera is set at a high elevation. Therefore its depth should be greater than that of the first person character controller camera. Lastly, deactivate the audio listener in the camera from the inspector view to avoid errors. In a game scene, only one audio listener is allowed and that should be your character controller’s camera.



Summary:
PIP means picture in picture effect. It is a process whereby you create a miniature screen which will be display in the main screen.  It can serve as a map for navigation purpose or it can make a player see what is ahead of it. Most multi-player games uses PIP effect where by different players are allowed to use a portion of the screen in a game scene.

No comments:

Post a Comment