Skip to content

Commit 1007e50

Browse files
committed
Version 2.2
1 parent 7197ba6 commit 1007e50

File tree

6 files changed

+32
-79
lines changed

6 files changed

+32
-79
lines changed

Assets/SteamVR/Input/SteamVR_Behaviour_Pose.cs

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ public class SteamVR_Behaviour_Pose : MonoBehaviour
6767
protected int deviceIndex = -1;
6868

6969
protected SteamVR_HistoryBuffer historyBuffer = new SteamVR_HistoryBuffer(30);
70-
71-
private bool debugVelocity = true;
72-
70+
7371

7472
protected virtual void Start()
7573
{
@@ -136,20 +134,6 @@ protected virtual void UpdateTransform()
136134
transform.localPosition = poseAction[inputSource].localPosition;
137135
transform.localRotation = poseAction[inputSource].localRotation;
138136
}
139-
140-
if (debugVelocity && isActive)
141-
{
142-
/*
143-
Vector3 positionAtTime, velocityAtTime, angularVelocityAtTime;
144-
Quaternion rotationAtTime;
145-
146-
poseAction[inputSource].GetPoseAtTimeOffset(1 * -0.011f, out positionAtTime, out rotationAtTime, out velocityAtTime, out angularVelocityAtTime);
147-
148-
SteamVR_Utils.DrawVelocity(-Time.frameCount, positionAtTime, velocityAtTime, Color.green);
149-
150-
SteamVR_Utils.DrawVelocity(Time.frameCount, transform.position, poseAction[inputSource].velocity, Color.red);
151-
*/
152-
}
153137
}
154138

155139
private void SteamVR_Behaviour_Pose_OnChange(SteamVR_Action_Pose fromAction, SteamVR_Input_Sources fromSource)
@@ -239,34 +223,6 @@ public void GetEstimatedPeakVelocities(out Vector3 velocity, out Vector3 angular
239223
historyBuffer.GetAverageVelocities(out velocity, out angularVelocity, 2, top);
240224
}
241225

242-
/// <summary>Rewrite the history buffer using SteamVR's actual recorded poses and get velocities based on those.</summary>
243-
public void GetRealPeakVelocities(out Vector3 velocity, out Vector3 angularVelocity)
244-
{
245-
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
246-
stopwatch.Start();
247-
248-
historyBuffer.Clear();
249-
250-
for (int framesBack = 1; framesBack < 15; framesBack++)
251-
{
252-
Vector3 positionAtTime, velocityAtTime, angularVelocityAtTime;
253-
Quaternion rotationAtTime;
254-
255-
poseAction[inputSource].GetPoseAtTimeOffset(framesBack * -0.011f, out positionAtTime, out rotationAtTime, out velocityAtTime, out angularVelocityAtTime);
256-
257-
historyBuffer.Update(positionAtTime, rotationAtTime, velocityAtTime, angularVelocityAtTime);
258-
}
259-
260-
int top = historyBuffer.GetTopVelocity(10, 1);
261-
262-
var step = historyBuffer.GetAtIndex(top);
263-
velocity = step.velocity;
264-
angularVelocity = step.angularVelocity;
265-
266-
stopwatch.Stop();
267-
Debug.Log("ms: " + stopwatch.Elapsed.TotalMilliseconds);
268-
}
269-
270226
protected int lastFrameUpdated;
271227
protected void UpdateHistoryBuffer()
272228
{

Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,6 @@ public void GetEstimatedPeakVelocities(out Vector3 velocity, out Vector3 angular
748748
angularVelocity = Player.instance.trackingOriginTransform.TransformDirection(angularVelocity);
749749
}
750750

751-
public void GetRealPeakVelocities(out Vector3 velocity, out Vector3 angularVelocity)
752-
{
753-
trackedObject.GetRealPeakVelocities(out velocity, out angularVelocity);
754-
velocity = Player.instance.trackingOriginTransform.TransformVector(velocity);
755-
angularVelocity = Player.instance.trackingOriginTransform.TransformDirection(angularVelocity);
756-
}
757-
758751

759752
//-------------------------------------------------
760753
private void CleanUpAttachedObjectStack()

Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public virtual void GetReleaseVelocities(Hand hand, out Vector3 velocity, out Ve
187187
angularVelocity = velocityEstimator.GetAngularVelocityEstimate();
188188
break;
189189
case ReleaseStyle.AdvancedEstimation:
190-
hand.GetRealPeakVelocities(out velocity, out angularVelocity);
190+
hand.GetEstimatedPeakVelocities(out velocity, out angularVelocity);
191191
break;
192192
case ReleaseStyle.GetFromHand:
193193
velocity = hand.GetTrackedObjectVelocity(releaseVelocityTimeOffset);

Assets/SteamVR/InteractionSystem/Samples/Interactions_Example.unity

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21597,11 +21597,6 @@ Prefab:
2159721597
propertyPath: m_LocalRotation.w
2159821598
value: 0.9906824
2159921599
objectReference: {fileID: 0}
21600-
- target: {fileID: 114000010658121184, guid: fb710a001890d9a44bb74a8ce4f20cc0,
21601-
type: 2}
21602-
propertyPath: scale
21603-
value: 1
21604-
objectReference: {fileID: 0}
2160521600
m_RemovedComponents: []
2160621601
m_ParentPrefab: {fileID: 100100000, guid: fb710a001890d9a44bb74a8ce4f20cc0, type: 2}
2160721602
m_IsPrefabParent: 0

Assets/SteamVR/Scripts/SteamVR.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,13 @@ private static string GetManifestFile()
433433

434434
string fullPath = Path.Combine(currentPath, "unityProject.vrmanifest");
435435

436+
FileInfo fullManifestPath = new FileInfo(SteamVR_Settings.instance.actionsFilePath);
437+
436438
if (File.Exists(fullPath))
437439
{
438440
string jsonText = File.ReadAllText(fullPath);
439441
SteamVR_Input_ManifestFile existingFile = Valve.Newtonsoft.Json.JsonConvert.DeserializeObject<SteamVR_Input_ManifestFile>(jsonText);
442+
440443
if (existingFile != null && existingFile.applications != null && existingFile.applications.Count > 0 &&
441444
existingFile.applications[0].app_key != SteamVR_Settings.instance.editorAppKey)
442445
{
@@ -446,6 +449,18 @@ private static string GetManifestFile()
446449
existingInfo.IsReadOnly = false;
447450
existingInfo.Delete();
448451
}
452+
453+
if (existingFile != null && existingFile.applications != null && existingFile.applications.Count > 0 &&
454+
existingFile.applications[0].action_manifest_path != fullManifestPath.FullName)
455+
{
456+
Debug.Log("<b>[SteamVR]</b> Deleting existing VRManifest because it has a different action manifest path:" +
457+
"\nExisting:" + existingFile.applications[0].action_manifest_path +
458+
"\nNew: " + fullManifestPath.FullName);
459+
FileInfo existingInfo = new FileInfo(fullPath);
460+
if (existingInfo.IsReadOnly)
461+
existingInfo.IsReadOnly = false;
462+
existingInfo.Delete();
463+
}
449464
}
450465

451466
if (File.Exists(fullPath) == false)
@@ -454,7 +469,7 @@ private static string GetManifestFile()
454469
manifestFile.source = "Unity";
455470
SteamVR_Input_ManifestFile_Application manifestApplication = new SteamVR_Input_ManifestFile_Application();
456471
manifestApplication.app_key = SteamVR_Settings.instance.editorAppKey;
457-
//manifestApplication.action_manifest_path = SteamVR_Settings.instance.actionsFilePath;
472+
manifestApplication.action_manifest_path = fullManifestPath.FullName;
458473
manifestApplication.launch_type = "url";
459474
//manifestApplication.binary_path_windows = SteamVR_Utils.ConvertToForwardSlashes(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
460475
//manifestApplication.binary_path_linux = SteamVR_Utils.ConvertToForwardSlashes(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
@@ -507,22 +522,19 @@ private static void IdentifyEditorApplication(bool showLogs = true)
507522
{
508523
bool isInstalled = OpenVR.Applications.IsApplicationInstalled(SteamVR_Settings.instance.editorAppKey);
509524

510-
if (isInstalled == false)
511-
{
512-
string manifestPath = GetManifestFile();
525+
string manifestPath = GetManifestFile();
513526

514-
var addManifestErr = OpenVR.Applications.AddApplicationManifest(manifestPath, true);
515-
if (addManifestErr != EVRApplicationError.None)
516-
Debug.LogError("<b>[SteamVR]</b> Error adding vr manifest file: " + addManifestErr.ToString());
517-
else
518-
{
519-
if (showLogs)
520-
Debug.Log("<b>[SteamVR]</b> Successfully added VR manifest to SteamVR");
521-
}
527+
EVRApplicationError addManifestErr = OpenVR.Applications.AddApplicationManifest(manifestPath, true);
528+
if (addManifestErr != EVRApplicationError.None)
529+
Debug.LogError("<b>[SteamVR]</b> Error adding vr manifest file: " + addManifestErr.ToString());
530+
else
531+
{
532+
if (showLogs)
533+
Debug.Log("<b>[SteamVR]</b> Successfully added VR manifest to SteamVR");
522534
}
523535

524536
int processId = System.Diagnostics.Process.GetCurrentProcess().Id;
525-
var applicationIdentifyErr = OpenVR.Applications.IdentifyApplication((uint)processId, SteamVR_Settings.instance.editorAppKey);
537+
EVRApplicationError applicationIdentifyErr = OpenVR.Applications.IdentifyApplication((uint)processId, SteamVR_Settings.instance.editorAppKey);
526538

527539
if (applicationIdentifyErr != EVRApplicationError.None)
528540
Debug.LogError("<b>[SteamVR]</b> Error identifying application: " + applicationIdentifyErr.ToString());

Assets/SteamVR/readme.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,33 @@ Documentation:
1515
Documentation can be found online here: https://valvesoftware.github.io/steamvr_unity_plugin/
1616

1717

18-
1918
Quick Start:
2019

21-
Follow the quickstart guide here:
22-
2320
If you want to explore the interaction scene you'll need to open the SteamVR Input window (under the Window Menu), click yes to copy example jsons, then click Save and Generate to create input actions.
2421

2522
For the most simple example of VR with tracked controllers see the sample scene at ​SteamVR/Simple Sample
2623

2724
For a more extensive example including picking up, throwing objects, and animated hands see the Interaction System example at ​SteamVR/Interaction System/Samples/Interactions_Example
2825

2926

30-
3127
Support:
3228

3329
If you're having trouble with the plugin the best place to discuss issues is our github here: https://github.com/ValveSoftware/steamvr_unity_plugin/issues/
3430

3531
If you'd like to discuss features, post guides, and give general feedback please post on the steam forum here: https://steamcommunity.com/app/250820/discussions/7/
3632

3733

38-
39-
Changes for 2.2:
40-
41-
* Removed some old functions/members in the skeleton behaviour
34+
Changes for v2.2:
35+
36+
* Removing some unused code
4237

4338

4439
Changes for v2.2RC5:
4540

4641
* Fix for controllers that don't support Skeleton Input yet (WinMR)
4742

43+
* Fixing issue where sometimes SteamVR would load legacy bindings for SteamVR Input projects while in the editor.
44+
4845

4946
Changes for v2.2RC4:
5047

0 commit comments

Comments
 (0)