Skip to content

Commit 8b44fd2

Browse files
committed
mengyu_vrscreencapture
1 parent fd3b64f commit 8b44fd2

File tree

4 files changed

+88
-22
lines changed

4 files changed

+88
-22
lines changed

Assets/Imports/Mengyu/VRScreenShot.cs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using UnityEngine;
2+
using UnityEngine.Experimental.Rendering;
3+
using Unity.Collections;
4+
using System.IO;
5+
using System.Collections.Generic;
6+
7+
[RequireComponent(typeof(VRTK.VRTK_ControllerEvents))]
8+
public class VRScreenShot : MonoBehaviour {
9+
string imgName;
10+
string imgTimeMark;
11+
public string namePrefix = "myCapture";
12+
bool captured = false;
13+
14+
void Start(){
15+
//GetComponent<VRTK.VRTK_ControllerEvents>().GripAxisChanged += new VRTK.ControllerInteractionEventHandler(DoGripAxisChanged);
16+
GetComponent<VRTK.VRTK_ControllerEvents>().GripPressed += new VRTK.ControllerInteractionEventHandler(DoGripPressed);
17+
}
18+
19+
public void takeScreenShot()
20+
{
21+
imgTimeMark = System.DateTime.Now.ToString("h:mm:ss tt");
22+
imgName = Application.dataPath + namePrefix + imgTimeMark + ".png";
23+
ScreenCapture.CaptureScreenshot(imgName);
24+
}
25+
26+
// private void DoGripAxisChanged(object sender, VRTK.ControllerInteractionEventArgs e){
27+
// if (e.buttonPressure > 0 && captured == false){
28+
// takeScreenShot();
29+
// Debug.Log("ScreenCaptured!");
30+
// captured = true;
31+
// } else if (e.buttonPressure == 0){
32+
// captured = false;
33+
// }
34+
// }
35+
private void DoGripPressed(object sender, VRTK.ControllerInteractionEventArgs e){
36+
takeScreenShot();
37+
Debug.Log("ScreenCaptured!");
38+
}
39+
}

Assets/Imports/Mengyu/VRScreenShot.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MainWorld.unity

+21-8
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Transform:
342342
type: 2}
343343
m_PrefabInternal: {fileID: 0}
344344
m_GameObject: {fileID: 35567643}
345-
m_LocalRotation: {x: -0.5929257, y: 0.38527796, z: 0.38527796, w: 0.5929257}
345+
m_LocalRotation: {x: -0.33616233, y: 0.62208915, z: 0.62208915, w: 0.33616233}
346346
m_LocalPosition: {x: 0, y: 0.82, z: -0}
347347
m_LocalScale: {x: 4.3740754, y: 4.3740788, z: 4.3740788}
348348
m_Children: []
@@ -5502,7 +5502,7 @@ Transform:
55025502
type: 2}
55035503
m_PrefabInternal: {fileID: 0}
55045504
m_GameObject: {fileID: 111248916}
5505-
m_LocalRotation: {x: -0.28725383, y: 0.64613104, z: -0.64613104, w: -0.28725383}
5505+
m_LocalRotation: {x: 0.38748363, y: 0.59148663, z: -0.59148663, w: 0.38748363}
55065506
m_LocalPosition: {x: 0, y: 0.44, z: 0}
55075507
m_LocalScale: {x: 1.7217813, y: 1.7217818, z: 1.7217818}
55085508
m_Children:
@@ -10382,7 +10382,7 @@ Transform:
1038210382
type: 2}
1038310383
m_PrefabInternal: {fileID: 0}
1038410384
m_GameObject: {fileID: 157190914}
10385-
m_LocalRotation: {x: -0.28725383, y: 0.64613104, z: -0.64613104, w: -0.28725383}
10385+
m_LocalRotation: {x: 0.38748363, y: 0.59148663, z: -0.59148663, w: 0.38748363}
1038610386
m_LocalPosition: {x: 0, y: 0.44, z: 0}
1038710387
m_LocalScale: {x: 1.7217813, y: 1.7217818, z: 1.7217818}
1038810388
m_Children:
@@ -21407,7 +21407,7 @@ Transform:
2140721407
type: 2}
2140821408
m_PrefabInternal: {fileID: 0}
2140921409
m_GameObject: {fileID: 457461564}
21410-
m_LocalRotation: {x: -0.5929257, y: 0.38527796, z: 0.38527796, w: 0.5929257}
21410+
m_LocalRotation: {x: -0.33616233, y: 0.62208915, z: 0.62208915, w: 0.33616233}
2141121411
m_LocalPosition: {x: 0, y: 0.82, z: -0}
2141221412
m_LocalScale: {x: 4.3740754, y: 4.3740788, z: 4.3740788}
2141321413
m_Children: []
@@ -46959,7 +46959,7 @@ Transform:
4695946959
type: 2}
4696046960
m_PrefabInternal: {fileID: 0}
4696146961
m_GameObject: {fileID: 876036066}
46962-
m_LocalRotation: {x: -0.5929257, y: 0.38527796, z: 0.38527796, w: 0.5929257}
46962+
m_LocalRotation: {x: -0.33616233, y: 0.62208915, z: 0.62208915, w: 0.33616233}
4696346963
m_LocalPosition: {x: 0, y: 0.82, z: -0}
4696446964
m_LocalScale: {x: 4.3740754, y: 4.3740788, z: 4.3740788}
4696546965
m_Children: []
@@ -52758,6 +52758,7 @@ GameObject:
5275852758
- component: {fileID: 1023100999}
5275952759
- component: {fileID: 1023100998}
5276052760
- component: {fileID: 1023101000}
52761+
- component: {fileID: 1023101001}
5276152762
- component: {fileID: 1023100997}
5276252763
m_Layer: 0
5276352764
m_Name: LeftController
@@ -52883,6 +52884,18 @@ MonoBehaviour:
5288352884
uiClickPressed: 0
5288452885
menuPressed: 0
5288552886
controllerVisible: 1
52887+
--- !u!114 &1023101001
52888+
MonoBehaviour:
52889+
m_ObjectHideFlags: 0
52890+
m_PrefabParentObject: {fileID: 0}
52891+
m_PrefabInternal: {fileID: 0}
52892+
m_GameObject: {fileID: 1023100995}
52893+
m_Enabled: 1
52894+
m_EditorHideFlags: 0
52895+
m_Script: {fileID: 11500000, guid: 7d5ca2583d5b43745b5da62e3cfe562c, type: 3}
52896+
m_Name:
52897+
m_EditorClassIdentifier:
52898+
namePrefix: myCapture
5288652899
--- !u!1 &1026697791
5288752900
GameObject:
5288852901
m_ObjectHideFlags: 0
@@ -54500,7 +54513,7 @@ Transform:
5450054513
type: 2}
5450154514
m_PrefabInternal: {fileID: 0}
5450254515
m_GameObject: {fileID: 1199293836}
54503-
m_LocalRotation: {x: -0.5929257, y: 0.38527796, z: 0.38527796, w: 0.5929257}
54516+
m_LocalRotation: {x: -0.33616233, y: 0.62208915, z: 0.62208915, w: 0.33616233}
5450454517
m_LocalPosition: {x: 0, y: 0.82, z: -0}
5450554518
m_LocalScale: {x: 4.3740754, y: 4.3740788, z: 4.3740788}
5450654519
m_Children: []
@@ -55626,7 +55639,7 @@ Transform:
5562655639
type: 2}
5562755640
m_PrefabInternal: {fileID: 0}
5562855641
m_GameObject: {fileID: 1342470225}
55629-
m_LocalRotation: {x: -0.28725383, y: 0.64613104, z: -0.64613104, w: -0.28725383}
55642+
m_LocalRotation: {x: 0.38748363, y: 0.59148663, z: -0.59148663, w: 0.38748363}
5563055643
m_LocalPosition: {x: 0, y: 0.44, z: 0}
5563155644
m_LocalScale: {x: 1.7217813, y: 1.7217818, z: 1.7217818}
5563255645
m_Children:
@@ -60660,7 +60673,7 @@ Transform:
6066060673
type: 2}
6066160674
m_PrefabInternal: {fileID: 0}
6066260675
m_GameObject: {fileID: 1442514441}
60663-
m_LocalRotation: {x: -0.28725383, y: 0.64613104, z: -0.64613104, w: -0.28725383}
60676+
m_LocalRotation: {x: 0.38748363, y: 0.59148663, z: -0.59148663, w: 0.38748363}
6066460677
m_LocalPosition: {x: 0, y: 0.44, z: 0}
6066560678
m_LocalScale: {x: 1.7217813, y: 1.7217818, z: 1.7217818}
6066660679
m_Children:

ProjectSettings/AudioManager.asset

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
%YAML 1.1
2-
%TAG !u! tag:unity3d.com,2011:
3-
--- !u!11 &1
4-
AudioManager:
5-
m_ObjectHideFlags: 0
6-
m_Volume: 1
7-
Rolloff Scale: 1
8-
Doppler Factor: 1
9-
Default Speaker Mode: 2
10-
m_SampleRate: 0
11-
m_DSPBufferSize: 0
12-
m_VirtualVoiceCount: 512
13-
m_RealVoiceCount: 32
14-
m_DisableAudio: 0
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!11 &1
4+
AudioManager:
5+
m_ObjectHideFlags: 0
6+
m_Volume: 1
7+
Rolloff Scale: 1
8+
Doppler Factor: 1
9+
Default Speaker Mode: 2
10+
m_SampleRate: 0
11+
m_DSPBufferSize: 1024
12+
m_VirtualVoiceCount: 512
13+
m_RealVoiceCount: 32
14+
m_SpatializerPlugin:
15+
m_AmbisonicDecoderPlugin:
16+
m_DisableAudio: 0
17+
m_VirtualizeEffects: 1

0 commit comments

Comments
 (0)