Skip to content

Commit 99cb9ee

Browse files
Merge pull request #839 from killerantz/fix/interactiveMeshCursor
The light now goes away when the cursor's visibility is set to false.
2 parents 500522b + 312036e commit 99cb9ee

File tree

3 files changed

+85
-36
lines changed

3 files changed

+85
-36
lines changed

Assets/HoloToolkit-Tests/Input/Scenes/InteractiveMeshCursor.unity

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OcclusionCullingSettings:
1313
--- !u!104 &2
1414
RenderSettings:
1515
m_ObjectHideFlags: 0
16-
serializedVersion: 7
16+
serializedVersion: 8
1717
m_Fog: 0
1818
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
1919
m_FogMode: 3
@@ -25,6 +25,7 @@ RenderSettings:
2525
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
2626
m_AmbientIntensity: 1
2727
m_AmbientMode: 0
28+
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
2829
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
2930
m_HaloStrength: 0.5
3031
m_FlareStrength: 1
@@ -41,7 +42,7 @@ RenderSettings:
4142
--- !u!157 &3
4243
LightmapSettings:
4344
m_ObjectHideFlags: 0
44-
serializedVersion: 7
45+
serializedVersion: 11
4546
m_GIWorkflowMode: 1
4647
m_GISettings:
4748
serializedVersion: 2
@@ -53,7 +54,7 @@ LightmapSettings:
5354
m_EnableBakedLightmaps: 1
5455
m_EnableRealtimeLightmaps: 1
5556
m_LightmapEditorSettings:
56-
serializedVersion: 4
57+
serializedVersion: 9
5758
m_Resolution: 2
5859
m_BakeResolution: 40
5960
m_TextureWidth: 1024
@@ -66,13 +67,27 @@ LightmapSettings:
6667
m_LightmapParameters: {fileID: 0}
6768
m_LightmapsBakeMode: 1
6869
m_TextureCompression: 1
69-
m_DirectLightInLightProbes: 1
7070
m_FinalGather: 0
7171
m_FinalGatherFiltering: 1
7272
m_FinalGatherRayCount: 256
7373
m_ReflectionCompression: 2
74+
m_MixedBakeMode: 1
75+
m_BakeBackend: 0
76+
m_PVRSampling: 1
77+
m_PVRDirectSampleCount: 32
78+
m_PVRSampleCount: 500
79+
m_PVRBounces: 2
80+
m_PVRFiltering: 0
81+
m_PVRFilteringMode: 1
82+
m_PVRCulling: 1
83+
m_PVRFilteringGaussRadiusDirect: 1
84+
m_PVRFilteringGaussRadiusIndirect: 5
85+
m_PVRFilteringGaussRadiusAO: 2
86+
m_PVRFilteringAtrousColorSigma: 1
87+
m_PVRFilteringAtrousNormalSigma: 1
88+
m_PVRFilteringAtrousPositionSigma: 1
7489
m_LightingDataAsset: {fileID: 0}
75-
m_RuntimeCPUUsage: 25
90+
m_UseShadowmask: 0
7691
--- !u!196 &4
7792
NavMeshSettings:
7893
serializedVersion: 2
@@ -89,6 +104,8 @@ NavMeshSettings:
89104
minRegionArea: 2
90105
manualCellSize: 0
91106
cellSize: 0.16666667
107+
manualTileSize: 0
108+
tileSize: 256
92109
accuratePlacement: 0
93110
m_NavMeshData: {fileID: 0}
94111
--- !u!1001 &46329470
@@ -156,7 +173,7 @@ Light:
156173
m_PrefabInternal: {fileID: 0}
157174
m_GameObject: {fileID: 785754854}
158175
m_Enabled: 1
159-
serializedVersion: 7
176+
serializedVersion: 8
160177
m_Type: 1
161178
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
162179
m_Intensity: 1
@@ -181,6 +198,22 @@ Light:
181198
m_Lightmapping: 4
182199
m_AreaSize: {x: 1, y: 1}
183200
m_BounceIntensity: 1
201+
m_FalloffTable:
202+
m_Table[0]: 0
203+
m_Table[1]: 0
204+
m_Table[2]: 0
205+
m_Table[3]: 0
206+
m_Table[4]: 0
207+
m_Table[5]: 0
208+
m_Table[6]: 0
209+
m_Table[7]: 0
210+
m_Table[8]: 0
211+
m_Table[9]: 0
212+
m_Table[10]: 0
213+
m_Table[11]: 0
214+
m_Table[12]: 0
215+
m_ColorTemperature: 6570
216+
m_UseColorTemperature: 0
184217
m_ShadowRadius: 0
185218
m_ShadowAngle: 0
186219
--- !u!4 &785754856
@@ -244,6 +277,7 @@ MeshRenderer:
244277
m_AutoUVMaxAngle: 89
245278
m_LightmapParameters: {fileID: 0}
246279
m_SortingLayerID: 0
280+
m_SortingLayer: 0
247281
m_SortingOrder: 0
248282
--- !u!65 &1060606162
249283
BoxCollider:
@@ -316,27 +350,6 @@ Prefab:
316350
propertyPath: m_RootOrder
317351
value: 3
318352
objectReference: {fileID: 0}
319-
- target: {fileID: 4000013367923696, guid: dc138879450c80f438141cbe47938daf, type: 2}
320-
propertyPath: m_LocalScale.x
321-
value: 1
322-
objectReference: {fileID: 0}
323-
- target: {fileID: 4000013367923696, guid: dc138879450c80f438141cbe47938daf, type: 2}
324-
propertyPath: m_LocalScale.y
325-
value: 1
326-
objectReference: {fileID: 0}
327-
- target: {fileID: 4000013367923696, guid: dc138879450c80f438141cbe47938daf, type: 2}
328-
propertyPath: m_LocalScale.z
329-
value: 1
330-
objectReference: {fileID: 0}
331-
- target: {fileID: 114698458312288788, guid: dc138879450c80f438141cbe47938daf,
332-
type: 2}
333-
propertyPath: DistanceScaleFactor
334-
value: 0.3
335-
objectReference: {fileID: 0}
336-
- target: {fileID: 1000012327360030, guid: dc138879450c80f438141cbe47938daf, type: 2}
337-
propertyPath: m_IsActive
338-
value: 1
339-
objectReference: {fileID: 0}
340353
m_RemovedComponents: []
341354
m_ParentPrefab: {fileID: 100100000, guid: dc138879450c80f438141cbe47938daf, type: 2}
342355
m_IsPrefabParent: 0

Assets/HoloToolkit/Input/Prefabs/Cursor/InteractiveMeshCursor.prefab

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ MeshRenderer:
163163
m_AutoUVMaxAngle: 89
164164
m_LightmapParameters: {fileID: 0}
165165
m_SortingLayerID: 0
166+
m_SortingLayer: 0
166167
m_SortingOrder: 0
167168
--- !u!23 &23000014103550452
168169
MeshRenderer:
@@ -195,6 +196,7 @@ MeshRenderer:
195196
m_AutoUVMaxAngle: 89
196197
m_LightmapParameters: {fileID: 0}
197198
m_SortingLayerID: 0
199+
m_SortingLayer: 0
198200
m_SortingOrder: 0
199201
--- !u!33 &33000012338699338
200202
MeshFilter:
@@ -217,7 +219,7 @@ Light:
217219
m_PrefabInternal: {fileID: 100100000}
218220
m_GameObject: {fileID: 1000012327360030}
219221
m_Enabled: 1
220-
serializedVersion: 7
222+
serializedVersion: 8
221223
m_Type: 2
222224
m_Color: {r: 1, g: 1, b: 1, a: 1}
223225
m_Intensity: 0.4
@@ -242,6 +244,22 @@ Light:
242244
m_Lightmapping: 4
243245
m_AreaSize: {x: 1, y: 1}
244246
m_BounceIntensity: 1
247+
m_FalloffTable:
248+
m_Table[0]: 0
249+
m_Table[1]: 0
250+
m_Table[2]: 0
251+
m_Table[3]: 0
252+
m_Table[4]: 0
253+
m_Table[5]: 0
254+
m_Table[6]: 0
255+
m_Table[7]: 0
256+
m_Table[8]: 0
257+
m_Table[9]: 0
258+
m_Table[10]: 0
259+
m_Table[11]: 0
260+
m_Table[12]: 0
261+
m_ColorTemperature: 6570
262+
m_UseColorTemperature: 0
245263
m_ShadowRadius: 0
246264
m_ShadowAngle: 0
247265
--- !u!114 &114698458312288788
@@ -266,6 +284,7 @@ MonoBehaviour:
266284
PrimaryCursorVisual: {fileID: 0}
267285
Ring: {fileID: 1000013883439490}
268286
Dot: {fileID: 1000010809468922}
287+
Light: {fileID: 1000012327360030}
269288
DistanceScaleFactor: 0.3
270289
DefaultScale: 0.5
271290
DownScale: 0.4

Assets/HoloToolkit/Input/Scripts/Cursor/InteractiveMeshCursor.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class InteractiveMeshCursor : Cursor
1616
[Tooltip("Inner cursor element")]
1717
public GameObject Dot;
1818

19+
[Tooltip("Point light")]
20+
public GameObject Light;
21+
1922
[Tooltip("The scale factor to soften the distance scaling, we want the cursor to scale in the distance, but not disapprear.")]
2023
public float DistanceScaleFactor = 0.3f;
2124

@@ -110,8 +113,7 @@ public override void OnCursorStateChange(CursorStateEnum state)
110113
// added observation of CursorModifier
111114
if (TargetedCursorModifier != null && mHasHover)
112115
{
113-
Ring.SetActive(!TargetedCursorModifier.GetCursorVisibility());
114-
Dot.SetActive(!TargetedCursorModifier.GetCursorVisibility());
116+
ElementVisibility(!TargetedCursorModifier.GetCursorVisibility());
115117
}
116118
}
117119

@@ -150,18 +152,33 @@ public override void SetVisiblity(bool visible)
150152
base.SetVisiblity(visible);
151153

152154
mIsVisible = visible;
155+
ElementVisibility(visible);
153156

154157
if (visible)
155158
{
156159
OnCursorStateChange(CursorState);
157160
}
158-
else
161+
}
162+
163+
/// <summary>
164+
/// controls the visibility of cursor elements in one place
165+
/// </summary>
166+
/// <param name="visible"></param>
167+
private void ElementVisibility(bool visible)
168+
{
169+
if (Ring != null)
159170
{
160-
if (Ring != null && Dot != null)
161-
{
162-
Ring.SetActive(visible);
163-
Dot.SetActive(visible);
164-
}
171+
Ring.SetActive(visible);
172+
}
173+
174+
if (Dot != null)
175+
{
176+
Dot.SetActive(visible);
177+
}
178+
179+
if (Light != null)
180+
{
181+
Light.SetActive(visible);
165182
}
166183
}
167184
}

0 commit comments

Comments
 (0)