Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"visualstudiotoolsforunity.vstuc"
]
}
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
}
]
}
60 changes: 60 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.vs": true,
"**/.gitmodules": true,
"**/.vsconfig": true,
"**/*.booproj": true,
"**/*.pidb": true,
"**/*.suo": true,
"**/*.user": true,
"**/*.userprefs": true,
"**/*.unityproj": true,
"**/*.dll": true,
"**/*.exe": true,
"**/*.pdf": true,
"**/*.mid": true,
"**/*.midi": true,
"**/*.wav": true,
"**/*.gif": true,
"**/*.ico": true,
"**/*.jpg": true,
"**/*.jpeg": true,
"**/*.png": true,
"**/*.psd": true,
"**/*.tga": true,
"**/*.tif": true,
"**/*.tiff": true,
"**/*.3ds": true,
"**/*.3DS": true,
"**/*.fbx": true,
"**/*.FBX": true,
"**/*.lxo": true,
"**/*.LXO": true,
"**/*.ma": true,
"**/*.MA": true,
"**/*.obj": true,
"**/*.OBJ": true,
"**/*.asset": true,
"**/*.cubemap": true,
"**/*.flare": true,
"**/*.mat": true,
"**/*.meta": true,
"**/*.prefab": true,
"**/*.unity": true,
"build/": true,
"Build/": true,
"Library/": true,
"library/": true,
"obj/": true,
"Obj/": true,
"Logs/": true,
"logs/": true,
"ProjectSettings/": true,
"UserSettings/": true,
"temp/": true,
"Temp/": true
},
"dotnet.defaultSolution": "VRTK.sln"
}
8 changes: 8 additions & 0 deletions Assets/Samples/BezierPointerTest.meta

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

81 changes: 81 additions & 0 deletions Assets/Samples/BezierPointerTest/AzimuthCheck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class AzimuthCheck : MonoBehaviour
{
public GameObject controller;
public static bool modifyAzimuth = false;
private float initLen = 0f;
private float initAzimuthAngle = 0f;
private float initAltitudeAngle = 0f;
private float curLen = 0f;
private float curAzimuthAngle = 0f;
private float curAltitudeAngle = 0f;
private float maxAzimuthLen = 0f;

// Start is called before the first frame update
void Start()
{
if (controller == null) {
controller = GameObject.FindGameObjectWithTag("Controller");
}
initLen = controller.GetComponent<InputActionProperty>().action.GetBindingIndex();
initAzimuthAngle = gameObject.transform.rotation.x;
initAltitudeAngle = gameObject.transform.rotation.z;
maxAzimuthLen = initLen;
}

// Update is called once per frame
void Update()
{
curAzimuthAngle = gameObject.transform.rotation.x;
curAltitudeAngle = gameObject.transform.rotation.z;
curLen = (float)Math.Cos(initLen * curAzimuthAngle) + (float)Math.Sin(initLen * curAltitudeAngle);

if (curLen == initLen) {
return;
}
if (curAzimuthAngle > initAzimuthAngle) {
if (curAltitudeAngle > initAltitudeAngle) {
modifyAzimuth = true;
}
else {
modifyAzimuth = false;
}
}
else {
if (curAltitudeAngle > initAltitudeAngle) {
modifyAzimuth = false;
}
else {
modifyAzimuth = true;
}
}
if (curAltitudeAngle > initAltitudeAngle) {
if (curAzimuthAngle > initAzimuthAngle) {
modifyAzimuth = false;
}
else {
modifyAzimuth = true;
}
}
else {
if (curAzimuthAngle > initAzimuthAngle) {
modifyAzimuth = true;
}
else {
modifyAzimuth = false;
}
}
}

void LateUpdate() {
if (modifyAzimuth) {
curLen /= (float)(Math.Sqrt(3) / 2);
}
controller.transform.position = new Vector3(controller.transform.position.x, controller.transform.position.y, controller.transform.position.z - curLen);
}
}
11 changes: 11 additions & 0 deletions Assets/Samples/BezierPointerTest/AzimuthCheck.cs.meta

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

Loading