Enable raw pointer
Enable the option to render a ray pointer (dot at end of the laser pointer)
This commit is contained in:
@@ -36,6 +36,8 @@ namespace ControllerSelection {
|
||||
public float rayDrawDistance = 500;
|
||||
[Tooltip("How far away the gaze pointer should be from the camera.")]
|
||||
public float gazeDrawDistance = 3;
|
||||
[Tooltip("Show gaze pointer as ray pointer.")]
|
||||
public bool showRayPointer = true;
|
||||
|
||||
[HideInInspector]
|
||||
public OVRInput.Controller activeController = OVRInput.Controller.None;
|
||||
@@ -63,13 +65,20 @@ namespace ControllerSelection {
|
||||
}
|
||||
|
||||
public void SetPointer(Ray ray) {
|
||||
float hitRayDrawDistance = rayDrawDistance;
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
{
|
||||
hitRayDrawDistance = hit.distance;
|
||||
}
|
||||
|
||||
if (linePointer != null) {
|
||||
linePointer.SetPosition(0, ray.origin);
|
||||
linePointer.SetPosition(1, ray.origin + ray.direction * rayDrawDistance);
|
||||
linePointer.SetPosition(1, ray.origin + ray.direction * hitRayDrawDistance);
|
||||
}
|
||||
|
||||
if (gazePointer != null) {
|
||||
gazePointer.position = ray.origin + ray.direction * gazeDrawDistance;
|
||||
gazePointer.position = ray.origin + ray.direction * (showRayPointer ? hitRayDrawDistance : gazeDrawDistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +88,7 @@ namespace ControllerSelection {
|
||||
linePointer.enabled = true;
|
||||
}
|
||||
if (gazePointer != null) {
|
||||
gazePointer.gameObject.SetActive(false);
|
||||
gazePointer.gameObject.SetActive(showRayPointer ? true : false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -87,7 +96,7 @@ namespace ControllerSelection {
|
||||
linePointer.enabled = false;
|
||||
}
|
||||
if (gazePointer != null) {
|
||||
gazePointer.gameObject.SetActive(true);
|
||||
gazePointer.gameObject.SetActive(showRayPointer ? false : true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,9 @@ namespace QuestAppLauncher
|
||||
// Canvas game object
|
||||
public GameObject canvas;
|
||||
|
||||
// Scroll view game object
|
||||
public GameObject scrollView;
|
||||
|
||||
// Grid content game object
|
||||
public GameObject gridContent;
|
||||
|
||||
@@ -175,6 +178,14 @@ namespace QuestAppLauncher
|
||||
// Adjust canvas rect transform
|
||||
var canvasRectTransform = this.canvas.GetComponent<RectTransform>();
|
||||
canvasRectTransform.sizeDelta = new Vector2(width, height);
|
||||
|
||||
// Adjust scroll view rect transform
|
||||
var scrollViewRectTransform = this.scrollView.GetComponent<RectTransform>();
|
||||
scrollViewRectTransform.sizeDelta = new Vector2(width, height);
|
||||
|
||||
// Adjust scroll view box collider
|
||||
var scrollViewBoxCollider = this.scrollView.GetComponent<BoxCollider>();
|
||||
scrollViewBoxCollider.size = new Vector3(width, height, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -319,7 +330,6 @@ namespace QuestAppLauncher
|
||||
var texture = new Texture2D(2, 2, TextureFormat.RGB24, false);
|
||||
texture.filterMode = FilterMode.Trilinear;
|
||||
texture.anisoLevel = 16;
|
||||
//texture.Resize(144, 100, TextureFormat.RGB24, false);
|
||||
texture.LoadImage(bytesIcon);
|
||||
var rect = new Rect(0, 0, texture.width, texture.height);
|
||||
image.sprite = Sprite.Create(texture, rect, new Vector2(0.5f, 0.5f));
|
||||
|
||||
@@ -56,7 +56,7 @@ Material:
|
||||
- _WeightNormal: 0
|
||||
m_Colors:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _FaceColor: {r: 0.007843138, g: 0.08235294, b: 0.18039216, a: 1}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||
--- !u!114 &11400000
|
||||
|
||||
Reference in New Issue
Block a user