gesture relative to player
This commit is contained in:
parent
4922174840
commit
aeaf7f4b22
|
@ -14,6 +14,8 @@ public class GestureRecognizer : MonoBehaviour
|
|||
public InputHelpers.Button rightInputButton;
|
||||
public InputHelpers.Button rightControlButton;
|
||||
|
||||
public Camera mainCamera;
|
||||
|
||||
public float inputThreshold = 0.1f;
|
||||
public Transform movementSource;
|
||||
|
||||
|
@ -31,10 +33,15 @@ public class GestureRecognizer : MonoBehaviour
|
|||
private List<Gesture> trainingSet = new List<Gesture>();
|
||||
private bool isMoving = false;
|
||||
private List<Vector3> positionsList = new List<Vector3>();
|
||||
private Vector3 relativePosition;
|
||||
private List<GameObject> debugCubes;
|
||||
private List<Vector3> relativePositions;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
debugCubes = new List<GameObject>();
|
||||
relativePositions = new List<Vector3>();
|
||||
// Path = ..\AppData\LocalLow\DefaultCompany\Heroes of Hiis SCM
|
||||
Debug.Log(Application.persistentDataPath);
|
||||
string[] gestureFiles = Directory.GetFiles(Application.persistentDataPath, "*.xml");
|
||||
|
@ -85,13 +92,18 @@ public class GestureRecognizer : MonoBehaviour
|
|||
|
||||
void StartMovement()
|
||||
{
|
||||
debugCubes.Clear();
|
||||
relativePositions.Clear();
|
||||
Debug.Log("Movement started");
|
||||
isMoving = true;
|
||||
positionsList.Clear();
|
||||
positionsList.Add(movementSource.position);
|
||||
relativePosition = movementSource.position - mainCamera.transform.position;
|
||||
positionsList.Add(relativePosition);
|
||||
if (debugCubePrefab)
|
||||
{
|
||||
Destroy(Instantiate(debugCubePrefab, movementSource.position, Quaternion.identity), 3);
|
||||
GameObject cube = Instantiate(debugCubePrefab, relativePosition, Quaternion.identity);
|
||||
debugCubes.Add(cube);
|
||||
relativePositions.Add(relativePosition);
|
||||
}
|
||||
}
|
||||
void EndMovement()
|
||||
|
@ -129,17 +141,31 @@ public class GestureRecognizer : MonoBehaviour
|
|||
|
||||
}
|
||||
}
|
||||
foreach(GameObject obj in debugCubes)
|
||||
{
|
||||
Destroy(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateMovement()
|
||||
{
|
||||
Vector3 lastPosition = positionsList[positionsList.Count - 1];
|
||||
if (Vector3.Distance(movementSource.position, lastPosition) > newPositionThresholdDistance)
|
||||
relativePosition = movementSource.position - mainCamera.transform.position;
|
||||
|
||||
|
||||
for(int i = 0; i < debugCubes.Count; i++)
|
||||
{
|
||||
positionsList.Add(movementSource.position);
|
||||
debugCubes[i].transform.position = mainCamera.transform.position + relativePositions[i];
|
||||
}
|
||||
|
||||
Vector3 lastPosition = positionsList[positionsList.Count - 1];
|
||||
if (Vector3.Distance(relativePosition, lastPosition) > newPositionThresholdDistance)
|
||||
{
|
||||
positionsList.Add(relativePosition);
|
||||
if (debugCubePrefab)
|
||||
{
|
||||
Destroy(Instantiate(debugCubePrefab, movementSource.position, Quaternion.identity), 3);
|
||||
GameObject cube = Instantiate(debugCubePrefab, relativePosition, Quaternion.identity);
|
||||
debugCubes.Add(cube);
|
||||
relativePositions.Add(relativePosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -90,19 +90,19 @@ Material:
|
|||
- _HorizonCloudSize: 4.91
|
||||
- _HorizonCloudStartPosition: -0.1
|
||||
- _HorizonCloudStep: 25
|
||||
- _HorizonExponent: 3.7730148
|
||||
- _HorizonExponent: 3.4183455
|
||||
- _HorizonStep: 500
|
||||
- _HorizonThickness: 1
|
||||
- _MoonGlow: 0
|
||||
- _MoonLightIntensity: 0.000008518849
|
||||
- _MoonLightIntensity: 0.00013525784
|
||||
- _MoonSize: 0
|
||||
- _MoonSoftEdge: 0
|
||||
- _OverheadCloudAltitude: 1000
|
||||
- _OverheadCloudAnimationSpeed: 50
|
||||
- _OverheadCloudFlowDirectionX: 1
|
||||
- _OverheadCloudFlowDirectionZ: 1
|
||||
- _OverheadCloudRemapMax: 1.2531662
|
||||
- _OverheadCloudRemapMin: 0.2223462
|
||||
- _OverheadCloudRemapMax: 1.0847162
|
||||
- _OverheadCloudRemapMin: 0.12044764
|
||||
- _OverheadCloudSize: 10
|
||||
- _OverheadCloudStep: 2
|
||||
- _StarsDensity0: 0.4
|
||||
|
@ -112,7 +112,7 @@ Material:
|
|||
- _StarsGlow0: 0.01
|
||||
- _StarsGlow1: 0.01
|
||||
- _StarsGlow2: 0.01
|
||||
- _StarsOpacity: 0
|
||||
- _StarsOpacity: 0.00015115738
|
||||
- _StarsSize0: 0.42
|
||||
- _StarsSize1: 0.53
|
||||
- _StarsSize2: 0.46
|
||||
|
@ -121,25 +121,25 @@ Material:
|
|||
- _StarsTwinkle1: 6
|
||||
- _StarsTwinkle2: 2
|
||||
- _SunGlow: 0.45
|
||||
- _SunLightIntensity: 0.41087142
|
||||
- _SunLightIntensity: 0.2358045
|
||||
- _SunSize: 0.1
|
||||
- _SunSoftEdge: 0.5
|
||||
m_Colors:
|
||||
- _DetailOverlayTintColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FogColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _GroundColor: {r: 0.42758024, g: 0.41111732, b: 0.44300514, a: 1}
|
||||
- _GroundColor: {r: 0.41143286, g: 0.39129925, b: 0.43029708, a: 1}
|
||||
- _HorizonCloudColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _HorizonColor: {r: 0.89793044, g: 0.87553227, b: 0.78631103, a: 1}
|
||||
- _HorizonColor: {r: 0.90498793, g: 0.8540903, b: 0.7451967, a: 1}
|
||||
- _MoonColor: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _MoonDirection: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _MoonLightColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.989025}
|
||||
- _SkyColor: {r: 0.23766041, g: 0.4377789, b: 0.6844221, a: 1}
|
||||
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.9659655}
|
||||
- _SkyColor: {r: 0.20780472, g: 0.36060733, b: 0.595583, a: 1}
|
||||
- _StarsColor0: {r: 0.96470594, g: 0.9450981, b: 0.76470596, a: 1}
|
||||
- _StarsColor1: {r: 1, g: 0.5294118, b: 0.93725497, a: 1}
|
||||
- _StarsColor2: {r: 0, g: 0.92549026, b: 1, a: 1}
|
||||
- _SunColor: {r: 0.9716981, g: 0.924848, b: 0.84745574, a: 1}
|
||||
- _SunDirection: {r: 0, g: -0.49374878, b: 0.8696046, a: 0}
|
||||
- _SunColor: {r: 0.97397786, g: 0.9310399, b: 0.8601923, a: 1}
|
||||
- _SunDirection: {r: 0, g: -0.27759162, b: 0.9606992, a: 0}
|
||||
- _SunLightColor: {r: 1, g: 0.9929226, b: 0.9009434, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &11400000
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -27,17 +27,17 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorBlend:
|
||||
m_Texture: {fileID: 8383841428176927265, guid: b6bbea2e1167a7346822545139402874,
|
||||
m_Texture: {fileID: 5538958299743588508, guid: b6bbea2e1167a7346822545139402874,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByHeight:
|
||||
m_Texture: {fileID: -4470815328621003127, guid: b6bbea2e1167a7346822545139402874,
|
||||
m_Texture: {fileID: -8094522862004650032, guid: b6bbea2e1167a7346822545139402874,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByNormal:
|
||||
m_Texture: {fileID: -1220541512051535516, guid: b6bbea2e1167a7346822545139402874,
|
||||
m_Texture: {fileID: -208912456559168404, guid: b6bbea2e1167a7346822545139402874,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
|
|
|
@ -40,17 +40,17 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorBlend:
|
||||
m_Texture: {fileID: 1318365803902414219, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
m_Texture: {fileID: 8185219008644317912, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByHeight:
|
||||
m_Texture: {fileID: -4211186723990843148, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
m_Texture: {fileID: -4402261139267660932, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByNormal:
|
||||
m_Texture: {fileID: -3561777244638167171, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
m_Texture: {fileID: 6947585048645296824, guid: 726ce83d589353742be6b48ff467fc48,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
|
|
|
@ -40,17 +40,17 @@ Material:
|
|||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorBlend:
|
||||
m_Texture: {fileID: -5933223485886743397, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
m_Texture: {fileID: -2460390883533451262, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByHeight:
|
||||
m_Texture: {fileID: -5251282745750488854, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
m_Texture: {fileID: 4231070066004387891, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ColorByNormal:
|
||||
m_Texture: {fileID: -1312613134760715702, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
m_Texture: {fileID: 1963612366038601208, guid: 7f589c682d367b442b8cf75918f5aa55,
|
||||
type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
|
|
Loading…
Reference in New Issue