Skip to content

Commit d0bd242

Browse files
committed
License + Readme + some fix
1 parent 6072a95 commit d0bd242

File tree

7 files changed

+192
-15
lines changed

7 files changed

+192
-15
lines changed

Assets/RayCursor/Scripts/CursorObject.cs

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
using RayCursor;
2-
using System.Collections;
3-
using System.Collections.Generic;
1+
/* Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
2+
(Université de Lille, Inria, France)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE. */
421
using UnityEngine;
522

623
namespace RayCursor

Assets/RayCursor/Scripts/DistanceUtil.cs

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
using System.Collections;
1+
/* Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
2+
(Université de Lille, Inria, France)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE. */
21+
using System.Collections;
222
using System.Collections.Generic;
323
using UnityEngine;
424

Assets/RayCursor/Scripts/RayCursor.cs

+47-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
using System.Collections;
1+
/* Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
2+
(Université de Lille, Inria, France)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE. */
221
using System.Collections.Generic;
322
using UnityEngine;
423

@@ -7,8 +26,7 @@ namespace RayCursor
726
{
827
public enum Mode
928
{
10-
Manual,
11-
SemiAuto,
29+
Manual, SemiAuto
1230
}
1331

1432
public enum TransferFunction
@@ -107,10 +125,10 @@ void Update()
107125
previousClosest = closest;
108126
}
109127

110-
if (Input.GetButtonDown("RayCursorSelect") && closest != null)
128+
if (GetInputSelect() && closest != null)
111129
{
112130
closest.Select();
113-
modes[currentMode].OnSelect();
131+
GetCursorMode().OnSelect();
114132
}
115133
}
116134

@@ -152,6 +170,28 @@ internal CursorTransferFunction GetCursorTransferFunction()
152170
{
153171
return transferFunctions[currentTransfertFunction];
154172
}
173+
174+
175+
/**
176+
* <summary>Return true only during the frame the selection button is pressed but was not pressed the frame before (like Input.GetButtonDown()).</summary>
177+
*/
178+
internal bool GetInputSelect()
179+
{
180+
return Input.GetButtonDown("RayCursorSelect");
181+
}
182+
183+
/**
184+
* <summary>Return true during all the frames the touchpad is touched.</summary>
185+
*/
186+
internal bool GetInputTouch()
187+
{
188+
return Input.GetButton("RayCursorTouch");
189+
}
190+
191+
internal float GetInputTouchY()
192+
{
193+
return Input.GetAxis("RayCursorTouchY");
194+
}
155195
}
156196

157197

@@ -330,8 +370,8 @@ public CursorTransferFunction(RayCursor cM)
330370

331371
public void Update()
332372
{
333-
bool currentPadTouch = Input.GetButton("RayCursorTouch");
334-
float currentPadY = Input.GetAxis("RayCursorTouchY");
373+
bool currentPadTouch = cursorManager.GetInputTouch();
374+
float currentPadY = cursorManager.GetInputTouchY();
335375
float currentTime = Time.time;
336376
if (!currentPadTouch || !previousPadTouch)
337377
ySpeed = 0;

Assets/RayCursor/Scripts/RayObject.cs

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
using OneEuroFilter;
2-
using System.Collections;
3-
using System.Collections.Generic;
1+
/* Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
2+
(Université de Lille, Inria, France)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE. */
21+
using OneEuroFilter;
422
using UnityEngine;
523

624
namespace RayCursor

Assets/RayCursor/Scripts/Selectable.cs

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
using System.Collections;
1+
/* Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
2+
(Université de Lille, Inria, France)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE. */
221
using System.Collections.Generic;
322
using UnityEngine;
423

LICENSE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright 2019 Marc Baloup, Géry Casiez, Thomas Pietrzak
4+
(Université de Lille, Inria, France)
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
this software and associated documentation files (the "Software"), to deal in
8+
the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do
11+
so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# RayCursor: A 3D Pointing Facilitation Technique based on Raycasting
2+
3+
This is a Unity Project containing the source code and prefab for the pointing technique RayCursor
4+
presented in [this paper](https://dx.doi.org/10.1145/3290605.3300331).
5+
6+
## Usage in your Unity project
7+
8+
1. Copy the folder `Assets/RayCursor` in your assets directory.
9+
2. In your scene, put the prefab `RayCursor` as a child of the GameObject reprenting a VR controller.
10+
3. On each GameObject you want to be selectable using RayCursor, add the component `Selectable`.
11+
These objects requires a Collider and a MeshRenderer.
12+
The highlight of the closest target only works on objects which have exactly one Material in the MeshRenderer.
13+
Each `Selectable` instance has an `OnSelect` event that you can listen to via scripting.
14+
4. Configure the inputs. The configuration depend on the API you use to access the controller inputs. See the next section for more details.
15+
16+
- Minimum version of Unity: `2018.3.0f2`
17+
- Only one instance of `RayCursor` is possible in a scene.
18+
19+
## Input configuration
20+
21+
### Legacy input system of unity (`Input.getXXX()`)
22+
23+
You have to configure 3 inputs in the configuration screen `Edit -> Project Settings... -> Input`
24+
25+
- `RayCursorSelect`: this input is used to trigger the selection. This is usually mapped to the trigger button of the controller.
26+
- `RayCursorTouch`: this input is used to detect the presence of the finger on the touchpad.
27+
- `RayCursorPadY`: this input is used to detect the `y` position of the finger on the touchpad.
28+
29+
You can copy the configuration of the inputs from the configuration of this project for the HTC Vive (Left Controller).
30+
31+
### Others API (Oculus, OpenVR, ...)
32+
33+
You have to change the source code of the 3 methods in `Scripts/RayCursor.cs`:
34+
35+
- `bool RayCursor.GetInputSelect()`
36+
- `bool RayCursor.GetInputTouch()`
37+
- `float RayCursor.GetInputTouchY()`
38+
39+
## License
40+
41+
This project is published under the MIT License (see `LICENSE.md`).

0 commit comments

Comments
 (0)