-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,154 changed files
with
78,836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.info | ||
*.log | ||
*.mdb | ||
*.xml | ||
*.dll | ||
*.pdb | ||
*.txt | ||
*.CopyComplete | ||
*.cache | ||
Library/metadata | ||
Temp/ | ||
*.ide | ||
*.meta |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ApplicationName":"SOF_HUD","OrganizationName":"DefaultCompany","ApplicationID":"com.defaultcompany.sof_hud","OrganizationID":"com","ApplicationVersion":"1.0","RunInBackground":true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Assets.Constants | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class Constants | ||
{ | ||
//public const float DegreesMultiplier = 0; | ||
//public const float MinutesMultiplier = 0; | ||
//public const float SecondsMultiplier = 0; | ||
public const float EarthRadius = 6378.137f; // Radius of earth in KM | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
using System; | ||
using System.Collections; | ||
using UnityEngine; | ||
|
||
namespace Assets.Controllers | ||
{ | ||
public class VectorController | ||
{ | ||
/// <summary> | ||
/// generally used geo measurement function | ||
/// </summary> | ||
/// <param name="one"></param> | ||
/// <param name="two"></param> | ||
/// <returns></returns> | ||
public float GetDistance(float latitudeA, float longitudeA, float latitudeB, float longitudeB) | ||
{ | ||
float dLat = DegreesToRadians(latitudeB) - DegreesToRadians(latitudeA); | ||
float dLon = DegreesToRadians(longitudeB) - DegreesToRadians(longitudeA); | ||
float a = Mathf.Sin(dLat / 2) * Mathf.Sin(dLat / 2) | ||
+ Mathf.Cos(DegreesToRadians(latitudeA)) | ||
* Mathf.Cos(DegreesToRadians(latitudeB)) | ||
* Mathf.Sin(dLon / 2) | ||
* Mathf.Sin(dLon / 2); | ||
float c = (float)(2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a))); | ||
float d = Constants.Constants.EarthRadius * c; | ||
return d * 1000f; // meters | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="latitudeA"></param> | ||
/// <param name="longitudeA"></param> | ||
/// <param name="latitudeB"></param> | ||
/// <param name="longitudeB"></param> | ||
/// <returns></returns> | ||
public float GetBearing(float latitudeA, float longitudeA, float latitudeB, float longitudeB) | ||
{ | ||
float y = Mathf.Sin(DegreesToRadians(longitudeB - longitudeA)); | ||
float x = Mathf.Cos(DegreesToRadians(latitudeA)) | ||
* Mathf.Sin(DegreesToRadians(latitudeB)) | ||
- Mathf.Sin(DegreesToRadians(latitudeA)) | ||
* Mathf.Cos(DegreesToRadians(latitudeB)) | ||
* Mathf.Cos(DegreesToRadians(longitudeB - longitudeA)); | ||
float dLat = DegreesToRadians(latitudeB) - DegreesToRadians(latitudeA); | ||
return RadiansToDegrees(Mathf.Atan2(y, x)); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Gets the bearing. | ||
/// </summary> | ||
/// <param name="latitudeA">The latitude a.</param> | ||
/// <param name="longitudeA">The longitude a.</param> | ||
/// <param name="latitudeB">The latitude b.</param> | ||
/// <param name="longitudeB">The longitude b.</param> | ||
/// <returns></returns> | ||
public float GetBearing(Vector3 pointA, Vector3 pointB) | ||
{ | ||
float y = Mathf.Sin(DegreesToRadians(pointB.z - pointA.z)); | ||
float x = Mathf.Cos(DegreesToRadians(pointA.x)) * Mathf.Sin(DegreesToRadians(pointB.x)) | ||
- Mathf.Sin(DegreesToRadians(pointA.x)) * Mathf.Cos(DegreesToRadians(pointB.x)) | ||
* Mathf.Cos(DegreesToRadians(pointB.z - pointA.z)); | ||
float dLat = DegreesToRadians(pointB.x) - DegreesToRadians(pointA.x); | ||
|
||
float returnMe = RadiansToDegrees(Mathf.Atan2(y, x)); | ||
|
||
if (returnMe < 0) | ||
{ | ||
returnMe = 360 + returnMe; | ||
} | ||
else if (returnMe > 360) | ||
{ | ||
returnMe = returnMe - 360; | ||
} | ||
|
||
return returnMe; | ||
} | ||
|
||
/// <summary> | ||
/// Normalizes the location. | ||
/// </summary> | ||
/// <param name="center">The center.</param> | ||
/// <param name="other">The other.</param> | ||
/// <returns></returns> | ||
public Vector3 NormalizeLocation(float centerLatitude, float centerLongitude, float otherLatitude, float otherLongitude) | ||
{ | ||
return new Vector3(LatitudeToMeters(otherLatitude) - LatitudeToMeters(centerLatitude), | ||
0, | ||
LongitudeToMeters(centerLongitude) - LongitudeToMeters(otherLongitude)); | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="radians"></param> | ||
/// <returns></returns> | ||
private float DegreesToRadians(float radians) | ||
{ | ||
return radians * Mathf.PI / 180.0f; | ||
} | ||
|
||
|
||
private float RadiansToDegrees(float radians) | ||
{ | ||
return radians * 180.0f / Mathf.PI; | ||
} | ||
|
||
/// <summary> | ||
/// Calculates the angle from sides. | ||
/// http://www.calculator.net/triangle-calculator.html?vc=90&vx=5&vy=7&va=&vz=&vb=&angleunits=d&x=44&y=27 | ||
/// </summary> | ||
/// <param name="a">a.</param> | ||
/// <param name="b">The b.</param> | ||
/// <returns></returns> | ||
private float calculateAngleFromSides(float sideA, float sideB, float sideC) | ||
{ | ||
return Mathf.Acos((Mathf.Pow(sideA, 2) + Mathf.Pow(sideB, 2) - Mathf.Pow(sideC, 2)) / (2 * sideA * sideB)); | ||
} | ||
|
||
/// <summary> | ||
/// Calculates the transform position for a waypoint based on its lat long and the cameras lat long | ||
/// The objective is to place the waypoint a short distance from the camera in the same direction as the remote GPS | ||
/// </summary> | ||
/// <param name="lat">The lat.</param> | ||
/// <param name="lon">The lon.</param> | ||
/// <returns></returns> | ||
public Vector3 getRelativePosition(float localLatitude, float localLongitude, float remoteLatitude, float remoteLongitude) | ||
{ | ||
float deltaLatitude = localLatitude - remoteLatitude; | ||
float deltaLongitude = localLongitude - remoteLongitude; | ||
Vector3 deltaPosition = new Vector3(LatitudeToMeters(deltaLatitude), 1, LongitudeToMeters(deltaLongitude)); | ||
Vector3 remotePosition = new Vector3(LatitudeToMeters(remoteLatitude), 1, LongitudeToMeters(remoteLongitude)); | ||
|
||
//we should use the current GPS to calculate the camera's position, but the demo has the camera starting at 0,0,0 for now. | ||
Vector3 localPosition = new Vector3(LatitudeToMeters(localLatitude), 1, LongitudeToMeters(localLongitude)); | ||
Vector3 demoPosition = new Vector3(0, 1, 0); | ||
|
||
return getPointOnLine(demoPosition, deltaPosition, 1f); | ||
} | ||
|
||
/// <summary> | ||
/// Calculate the number of meters per degree of latitude at a given latitude. | ||
/// </summary> | ||
/// <param name="degrees"></param> | ||
/// <returns></returns> | ||
public float LatitudeToMeters(float degrees) | ||
{ | ||
return 111132.92f - 559.82f * Mathf.Cos(2 * degrees) + 1.175f * Mathf.Cos(4 * degrees) - 0.0023f * Mathf.Cos(6 * degrees); | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Calculate the number of meters per degree of longitude at a given longitude. | ||
/// </summary> | ||
/// <param name="degrees"></param> | ||
/// <returns></returns> | ||
public float LongitudeToMeters(float degrees) | ||
{ | ||
return 111412.84f * Mathf.Cos(degrees) - 93.5f * Mathf.Cos(3 * degrees) + 0.118f * Mathf.Cos(5 * degrees); | ||
|
||
} | ||
|
||
|
||
/// <summary> | ||
/// Gets the point on line. | ||
/// </summary> | ||
/// <param name="pointA">The point a.</param> | ||
/// <param name="pointB">The point b.</param> | ||
/// <param name="distance">The distance.</param> | ||
/// <returns></returns> | ||
private Vector3 getPointOnLine(Vector3 pointA, Vector3 pointB, float distance) | ||
{ | ||
Vector3 vector = pointA - pointB; | ||
float vectorLength = Mathf.Sqrt(Mathf.Pow(vector.x, 2) + Mathf.Pow(vector.y, 2)); | ||
Vector3 unitVector = vector / vectorLength; | ||
Vector3 returnMe = pointA + (unitVector * distance); | ||
return returnMe; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!91 &9100000 | ||
AnimatorController: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_Name: BackButton | ||
serializedVersion: 5 | ||
m_AnimatorParameters: | ||
- m_Name: pointer_enter | ||
m_Type: 4 | ||
m_DefaultFloat: 0 | ||
m_DefaultInt: 0 | ||
m_DefaultBool: 0 | ||
m_Controller: {fileID: 9100000} | ||
m_AnimatorLayers: | ||
- serializedVersion: 5 | ||
m_Name: Base Layer | ||
m_StateMachine: {fileID: 1107000012801107726} | ||
m_Mask: {fileID: 0} | ||
m_Motions: [] | ||
m_Behaviours: [] | ||
m_BlendingMode: 0 | ||
m_SyncedLayerIndex: -1 | ||
m_DefaultWeight: 0 | ||
m_IKPass: 0 | ||
m_SyncedLayerAffectsTiming: 0 | ||
m_Controller: {fileID: 9100000} | ||
--- !u!1102 &1102000013667546444 | ||
AnimatorState: | ||
serializedVersion: 5 | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_Name: Initial | ||
m_Speed: 5 | ||
m_CycleOffset: 0 | ||
m_Transitions: [] | ||
m_StateMachineBehaviours: [] | ||
m_Position: {x: 50, y: 50, z: 0} | ||
m_IKOnFeet: 0 | ||
m_WriteDefaultValues: 1 | ||
m_Mirror: 0 | ||
m_SpeedParameterActive: 0 | ||
m_MirrorParameterActive: 0 | ||
m_CycleOffsetParameterActive: 0 | ||
m_Motion: {fileID: 7400000, guid: 6164934a479cd4c5ebf8c15eb8d72399, type: 2} | ||
m_Tag: | ||
m_SpeedParameter: | ||
m_MirrorParameter: | ||
m_CycleOffsetParameter: | ||
--- !u!1107 &1107000012801107726 | ||
AnimatorStateMachine: | ||
serializedVersion: 5 | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_Name: Base Layer | ||
m_ChildStates: | ||
- serializedVersion: 1 | ||
m_State: {fileID: 1102000013667546444} | ||
m_Position: {x: 372, y: 12, z: 0} | ||
m_ChildStateMachines: [] | ||
m_AnyStateTransitions: [] | ||
m_EntryTransitions: [] | ||
m_StateMachineTransitions: {} | ||
m_StateMachineBehaviours: [] | ||
m_AnyStatePosition: {x: 50, y: 20, z: 0} | ||
m_EntryPosition: {x: 50, y: 120, z: 0} | ||
m_ExitPosition: {x: 800, y: 120, z: 0} | ||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} | ||
m_DefaultState: {fileID: 1102000013667546444} |
Oops, something went wrong.