Skip to content

Commit

Permalink
Forced controllers to render, need to offset position and rotation
Browse files Browse the repository at this point in the history
msub2 committed Jan 29, 2021
1 parent 4c75146 commit df62523
Showing 12 changed files with 235 additions and 12 deletions.
80 changes: 80 additions & 0 deletions Assets/Models/Input/Materials/ControllerWmrBase 1.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ControllerWmrBase 1
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION _LIGHTMAPPING_REALTIME
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 2800000, guid: cdb20a1bb3340bc4f96765167c3ba04b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: b9c5729aa62e474489b1f80594cf34b8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EmissionScaleUI: 1
- _GlossMapScale: 1
- _Glossiness: 0.086
- _GlossyReflections: 1
- _Lightmapping: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0.9999999, g: 0.9999999, b: 0.9999999, a: 0.99999994}
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
8 changes: 8 additions & 0 deletions Assets/Models/Input/Materials/ControllerWmrBase 1.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Assets/Prefabs/Input/ControllerBase.prefab
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ MeshRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@@ -65,6 +66,7 @@ MeshRenderer:
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
16 changes: 16 additions & 0 deletions Assets/Prefabs/VrSystems/ForceControllerRendererActive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ForceControllerRendererActive : MonoBehaviour
{
void Start()
{
foreach (MeshRenderer renderer in GetComponentsInChildren<MeshRenderer>())
{
// All of these are off for some reason. Why? Haven't figured it out yet.
renderer.enabled = true;
}
}

}
11 changes: 11 additions & 0 deletions Assets/Prefabs/VrSystems/ForceControllerRendererActive.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 42 additions & 1 deletion Assets/Prefabs/VrSystems/SteamWmrControls.prefab
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ GameObject:
m_Component:
- component: {fileID: 4000011949354466}
- component: {fileID: 114000011240657384}
- component: {fileID: 1479809584682781803}
m_Layer: 0
m_Name: SteamWmrControls
m_TagString: Untagged
@@ -55,7 +56,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010438099326}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.1}
m_LocalScale: {x: 10, y: 10, z: 10}
m_Children:
- {fileID: 4000010267600154}
@@ -88,6 +89,18 @@ MonoBehaviour:
m_TouchpadActivationRange: {x: -0.8, y: 0.8}
m_LogitechPenActivationRange: {x: 0, y: 1}
m_WandRotateJoystickPercent: 0.7
--- !u!114 &1479809584682781803
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010438099326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3c9b402cc209d934892afe3dd3c8d0a3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1000012863469616
GameObject:
m_ObjectHideFlags: 0
@@ -99,6 +112,7 @@ GameObject:
- component: {fileID: 4000010915250370}
- component: {fileID: 114000013332822508}
- component: {fileID: 114000013512061632}
- component: {fileID: 4983754374125726131}
m_Layer: 14
m_Name: Controller (brush)
m_TagString: Untagged
@@ -155,6 +169,19 @@ MonoBehaviour:
type: 2}
m_TriggerMaterialInactive: {fileID: 2100000, guid: 0febb0642a50e644ab2b4f075fe32a9b,
type: 2}
--- !u!114 &4983754374125726131
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000012863469616}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81f018e4326e3394db56a8af0ea29dc1, type: 3}
m_Name:
m_EditorClassIdentifier:
hand: 1
--- !u!1 &1000013186975256
GameObject:
m_ObjectHideFlags: 0
@@ -166,6 +193,7 @@ GameObject:
- component: {fileID: 4000010267600154}
- component: {fileID: 114000010919708240}
- component: {fileID: 114000011013631904}
- component: {fileID: 7086576302309089470}
m_Layer: 14
m_Name: Controller (wand)
m_TagString: Untagged
@@ -222,3 +250,16 @@ MonoBehaviour:
type: 2}
m_TriggerMaterialInactive: {fileID: 2100000, guid: 0febb0642a50e644ab2b4f075fe32a9b,
type: 2}
--- !u!114 &7086576302309089470
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000013186975256}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81f018e4326e3394db56a8af0ea29dc1, type: 3}
m_Name:
m_EditorClassIdentifier:
hand: 0
24 changes: 17 additions & 7 deletions Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
@@ -3165,11 +3165,11 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 152983283}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 652605545}
m_Father: {fileID: 1476953173}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &152983285
@@ -6850,7 +6850,7 @@ RectTransform:
- {fileID: 617891838}
- {fileID: 756087798}
m_Father: {fileID: 652605545}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -9191,7 +9191,6 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 152983284}
- {fileID: 1412532063}
- {fileID: 383974627}
- {fileID: 669339392}
@@ -9903,7 +9902,7 @@ Transform:
- {fileID: 1894562680}
- {fileID: 2095572864}
m_Father: {fileID: 652605545}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &670109498
PrefabInstance:
@@ -17358,7 +17357,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 652605545}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1414582882
GameObject:
@@ -18174,7 +18173,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 152983284}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -31050,6 +31050,16 @@ PrefabInstance:
propertyPath: m_LocalPosition.y
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4676525938658093118, guid: ea7c0165e16afe349a301abf9c89f74d,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6659729026770501894, guid: ea7c0165e16afe349a301abf9c89f74d,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ea7c0165e16afe349a301abf9c89f74d, type: 3}
--- !u!1 &2073328682
6 changes: 3 additions & 3 deletions Assets/Scripts/App.cs
Original file line number Diff line number Diff line change
@@ -48,11 +48,11 @@ public class App : MonoBehaviour {
// As a minimum, you should change kAppDisplayName.

// This is the name of the app, as displayed to the users running it.
public const string kAppDisplayName = "Open Source Tilt Brush";
public const string kAppDisplayName = "Silk Brush";
// The vendor name - used for naming android builds - shouldn't have spaces.
public const string kVendorName = "SomeCompany";
public const string kVendorName = "msub2";
// The vendor name - used for the company name in builds and fbx output. Can have spaces.
public const string kDisplayVendorName = "Some Company";
public const string kDisplayVendorName = "msub2";
// This is the App name used when speaking to Google services
public const string kGoogleServicesAppName = kAppDisplayName;
// The name of the configuration file. You may want to change this if you think your users may
3 changes: 2 additions & 1 deletion Assets/Scripts/Input/ControllerConsoleScript.cs
Original file line number Diff line number Diff line change
@@ -214,6 +214,7 @@ void Update() {
m_ActivateTimer -= Time.deltaTime * m_ActivateSpeed;
if (m_ActivateTimer <= 0.0f) {
m_ActivateTimer = 0.0f;
Debug.Log("I'm over here");
SetState(State.Disabled);
}
}
@@ -222,7 +223,7 @@ void Update() {
}
}

void SetState(State rDesiredState) {
void SetState(State rDesiredState) {
switch (rDesiredState) {
case State.Disabled:
m_RenderablesParent.gameObject.SetActive(false);
42 changes: 42 additions & 0 deletions Assets/Scripts/Input/WebXRPoseLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using WebXR;

public class WebXRPoseLink : MonoBehaviour
{
public enum Hand
{
Left,
Right
}

public Hand hand;
private Transform controller;

// Start is called before the first frame update
void Start()
{
if (hand == Hand.Left)
controller = GameObject.Find("handL").transform;
else
controller = GameObject.Find("handR").transform;
}

// Update is called once per frame
void Update()
{
UpdatePose();
}

private void UpdatePose()
{
Vector3 adjustedPos = controller.localPosition;
adjustedPos.z += .5f;
transform.localPosition = adjustedPos;

Vector3 adjustedRot = controller.rotation.eulerAngles;
adjustedRot.x += 30;
transform.rotation = Quaternion.Euler(adjustedRot);
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Input/WebXRPoseLink.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Scripts/VrSdk.cs
Original file line number Diff line number Diff line change
@@ -708,6 +708,7 @@ public DoF GetControllerDof()
{
case SdkMode.Oculus:
case SdkMode.SteamVR:
case SdkMode.WebXR:
return DoF.Six;

case SdkMode.Gvr:

0 comments on commit df62523

Please sign in to comment.