Skip to content

Commit bc25bcc

Browse files
committed
Make control for Camera
If u dont need conrol, dont import ghost skript
1 parent 25ce389 commit bc25bcc

8 files changed

Lines changed: 161 additions & 11 deletions

File tree

CameraScreenShot/Assets/Recorder/RenderTexture/RenderTexture.renderTexture

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ RenderTexture:
1313
m_ForcedFallbackFormat: 4
1414
m_DownscaleFallback: 0
1515
serializedVersion: 3
16-
m_Width: 760
17-
m_Height: 561
16+
m_Width: 800
17+
m_Height: 450
1818
m_AntiAliasing: 1
1919
m_MipCount: -1
2020
m_DepthFormat: 2

CameraScreenShot/Assets/Additions/GhostFreeRoamCamera/Scripts/GhostFreeRoamCamera.cs renamed to CameraScreenShot/Assets/Recorder/Scripts/GhostFreeRoamCamera.cs

File renamed without changes.

CameraScreenShot/Assets/Additions/GhostFreeRoamCamera/Scripts/GhostFreeRoamCamera.cs.meta renamed to CameraScreenShot/Assets/Recorder/Scripts/GhostFreeRoamCamera.cs.meta

File renamed without changes.

CameraScreenShot/Assets/Recorder/Scripts/VideoRecorder.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class VideoRecorder : MonoBehaviour
1515
float Height=Screen.height;
1616
private string dataPath;
1717
public bool UseScreenSize=true;
18-
18+
public bool MakeFreezingForCinema = true;
19+
public bool AlwaysOn = false;
1920
#region VideoCapt
2021
public int frameRate = 30;
2122
bool isCapturing = false;
@@ -44,7 +45,7 @@ private void Awake()
4445
VideoTexture.width = (int) Width;
4546
VideoTexture.height = (int) Height;
4647
}
47-
48+
if(!AlwaysOn)
4849
ScrnCam.gameObject.SetActive(false);
4950
//если нет директории сохранения файла
5051
bool exists = System.IO.Directory.Exists(dataPath);
@@ -68,9 +69,13 @@ public void MakeVideo()
6869
Directory.CreateDirectory(path);
6970
path = path + "/";
7071
} else {
72+
if(!AlwaysOn)
7173
ScrnCam.gameObject.SetActive(false);
72-
Time.timeScale = 1f;
73-
//Time.fixedDeltaTime = fixedDeltaTimeCache;
74+
if (MakeFreezingForCinema)
75+
{
76+
Time.timeScale = 1f;
77+
//Time.fixedDeltaTime = fixedDeltaTimeCache;
78+
}
7479
}
7580
}
7681
void LateUpdate () {
@@ -95,8 +100,11 @@ void LateUpdate () {
95100
//декодируем в png, для наивышего качества
96101

97102
imgIndex+=1;
98-
Time.timeScale = 1.0f/localDeltaTime/frameRate;
99-
//Time.fixedDeltaTime = fixedDeltaTimeCache / Time.timeScale;
103+
if (MakeFreezingForCinema)
104+
{
105+
//Time.timeScale = 1.0f/localDeltaTime/frameRate;
106+
//Time.fixedDeltaTime = fixedDeltaTimeCache / Time.timeScale;
107+
}
100108
}
101109
}
102110
//переводим из RenderTexture в Texture2D

CameraScreenShot/Assets/Scenes/DemoScene.unity

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10487,8 +10487,8 @@ Transform:
1048710487
m_PrefabAsset: {fileID: 0}
1048810488
m_GameObject: {fileID: 940767242}
1048910489
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
10490-
m_LocalPosition: {x: -1.28, y: 2.7, z: -11.66}
10491-
m_LocalScale: {x: 1, y: 1, z: 1}
10490+
m_LocalPosition: {x: 0, y: 0, z: -12.11}
10491+
m_LocalScale: {x: 1, y: 1, z: 0}
1049210492
m_Children: []
1049310493
m_Father: {fileID: 0}
1049410494
m_RootOrder: 0
@@ -10516,6 +10516,50 @@ MonoBehaviour:
1051610516
cursorSensitivity: 0.015
1051710517
cursorToggleAllowed: 1
1051810518
cursorToggleButton: 27
10519+
--- !u!1 &1110727728
10520+
GameObject:
10521+
m_ObjectHideFlags: 0
10522+
m_CorrespondingSourceObject: {fileID: 0}
10523+
m_PrefabInstance: {fileID: 0}
10524+
m_PrefabAsset: {fileID: 0}
10525+
serializedVersion: 6
10526+
m_Component:
10527+
- component: {fileID: 1110727730}
10528+
- component: {fileID: 1110727729}
10529+
m_Layer: 0
10530+
m_Name: GameManager
10531+
m_TagString: Untagged
10532+
m_Icon: {fileID: 0}
10533+
m_NavMeshLayer: 0
10534+
m_StaticEditorFlags: 0
10535+
m_IsActive: 1
10536+
--- !u!114 &1110727729
10537+
MonoBehaviour:
10538+
m_ObjectHideFlags: 0
10539+
m_CorrespondingSourceObject: {fileID: 0}
10540+
m_PrefabInstance: {fileID: 0}
10541+
m_PrefabAsset: {fileID: 0}
10542+
m_GameObject: {fileID: 1110727728}
10543+
m_Enabled: 1
10544+
m_EditorHideFlags: 0
10545+
m_Script: {fileID: 11500000, guid: 9f3e71c0419a3af4f8794a56f69d8e3a, type: 3}
10546+
m_Name:
10547+
m_EditorClassIdentifier:
10548+
updateInterval: 0.5
10549+
--- !u!4 &1110727730
10550+
Transform:
10551+
m_ObjectHideFlags: 0
10552+
m_CorrespondingSourceObject: {fileID: 0}
10553+
m_PrefabInstance: {fileID: 0}
10554+
m_PrefabAsset: {fileID: 0}
10555+
m_GameObject: {fileID: 1110727728}
10556+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
10557+
m_LocalPosition: {x: 0.93682176, y: -1.9206669, z: -9.1399555}
10558+
m_LocalScale: {x: 1, y: 1, z: 1}
10559+
m_Children: []
10560+
m_Father: {fileID: 0}
10561+
m_RootOrder: 6
10562+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1051910563
--- !u!1 &1130718653
1052010564
GameObject:
1052110565
m_ObjectHideFlags: 0
@@ -10546,6 +10590,35 @@ Transform:
1054610590
m_Father: {fileID: 2116274539}
1054710591
m_RootOrder: 0
1054810592
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
10593+
--- !u!1 &1130737437 stripped
10594+
GameObject:
10595+
m_CorrespondingSourceObject: {fileID: 8698702305771576501, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
10596+
type: 3}
10597+
m_PrefabInstance: {fileID: 8698702305197442987}
10598+
m_PrefabAsset: {fileID: 0}
10599+
--- !u!114 &1130737441
10600+
MonoBehaviour:
10601+
m_ObjectHideFlags: 0
10602+
m_CorrespondingSourceObject: {fileID: 0}
10603+
m_PrefabInstance: {fileID: 0}
10604+
m_PrefabAsset: {fileID: 0}
10605+
m_GameObject: {fileID: 1130737437}
10606+
m_Enabled: 1
10607+
m_EditorHideFlags: 0
10608+
m_Script: {fileID: 11500000, guid: 436275a13d4459746955fc6db5953473, type: 3}
10609+
m_Name:
10610+
m_EditorClassIdentifier:
10611+
initialSpeed: 10
10612+
increaseSpeed: 1.25
10613+
allowMovement: 1
10614+
allowRotation: 1
10615+
forwardButton: 119
10616+
backwardButton: 115
10617+
rightButton: 100
10618+
leftButton: 97
10619+
cursorSensitivity: 0.025
10620+
cursorToggleAllowed: 1
10621+
cursorToggleButton: 27
1054910622
--- !u!1 &1210740250
1055010623
GameObject:
1055110624
m_ObjectHideFlags: 0
@@ -10941,6 +11014,21 @@ PrefabInstance:
1094111014
m_Modification:
1094211015
m_TransformParent: {fileID: 0}
1094311016
m_Modifications:
11017+
- target: {fileID: 8698702305771576500, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
11018+
type: 3}
11019+
propertyPath: QualityOfCam
11020+
value: 1
11021+
objectReference: {fileID: 0}
11022+
- target: {fileID: 8698702305771576500, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
11023+
type: 3}
11024+
propertyPath: MakeFreezingForCinema
11025+
value: 0
11026+
objectReference: {fileID: 0}
11027+
- target: {fileID: 8698702305771576500, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
11028+
type: 3}
11029+
propertyPath: UseScreenSize
11030+
value: 0
11031+
objectReference: {fileID: 0}
1094411032
- target: {fileID: 8698702306325612611, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
1094511033
type: 3}
1094611034
propertyPath: m_LocalPosition.x
@@ -10954,7 +11042,7 @@ PrefabInstance:
1095411042
- target: {fileID: 8698702306325612611, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
1095511043
type: 3}
1095611044
propertyPath: m_LocalPosition.z
10957-
value: -11.14
11045+
value: -12.11
1095811046
objectReference: {fileID: 0}
1095911047
- target: {fileID: 8698702306325612611, guid: e1dc5e1aa1b832d45b8aeb2267a3fce9,
1096011048
type: 3}

CameraScreenShot/Assets/Scripts.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using UnityEngine;
2+
using System.Collections;
3+
4+
// An FPS counter.
5+
// It calculates frames/second over each updateInterval,
6+
// so the display does not keep changing wildly.
7+
public class FpsCounter : MonoBehaviour
8+
{
9+
public float updateInterval = 0.5F;
10+
private double lastInterval;
11+
private int frames = 0;
12+
private float fps;
13+
void Start()
14+
{
15+
lastInterval = Time.realtimeSinceStartup;
16+
frames = 0;
17+
}
18+
19+
void OnGUI()
20+
{
21+
GUILayout.Label("" + fps.ToString("f2"));
22+
}
23+
24+
void Update()
25+
{
26+
++frames;
27+
float timeNow = Time.realtimeSinceStartup;
28+
if (timeNow > lastInterval + updateInterval)
29+
{
30+
fps = (float)(frames / (timeNow - lastInterval));
31+
frames = 0;
32+
lastInterval = timeNow;
33+
}
34+
}
35+
}

CameraScreenShot/Assets/Scripts/FpsCounter.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)