Skip to content

Stages_Cameras

marcatore edited this page Jun 1, 2018 · 4 revisions

To add replay cameras to your stage you have to select the "layoutXXX" gameboject.
Go to inspector, scroll down to the "Replay Script"
Now, using the 3d viewport, you can set the camera position according to the world position you have when you move your point of view in the 3d viewport. Look at this example.
Move the 3d view until you can see the white marker (the car start position). Then press "Add camera" button in the "Replay Script" component.
Now, move your 3d view and you can see a purple sphere in the 3d space. That point is the camera position.
Now, move your 3d view along the stage and press "Add camera" everytime you want a cam.

When you finished with the cam positioning, you have to set the logic about changing from a cam to another one. First of all you have to sort the cameras. Press "Sort cameras"
The camera markers are now renamed based on the near value of path length.


Now you're ready to set the cam changing logic.
Press the "Start simulation" button.
Unity now opens a new window with the first 2 cams.
The upper view is the current cam, the cam I see ingame when I load a replay with gRally. Below there is the view from the next cam. The yellow sphere is the placeholder of the car.

Now you have to set the point where you want to switch from a cam to the next one. To do this, go to the inspector and check that "On Simulation" is ON. Then, change the distance value.
You can see the yellow sphere starts moving according to the distance value. When the sphere reaches the point where you want to make the switch, press the "Change Camera!" button.

Now the cam that was in the second view of the "Camera viewer" switched to the first view and below there is the next one. Change the distance value again and when you want to make another switch, press the "Change Camera!" button.

Repeat this until you finished.

At the end, you can press the "Stop Simulation" button.
Now you can export the stage.

Additional notes

Fixed Cam
You can set a cam as a fixed cam.
Select the cam in the hierarchy panel.
Go to the inspector and switch ON the "Is fixed" property.