diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 3b15bd10..c746b9e7 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -761,6 +761,53 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 009dfb7b117049a1a3f2a2e9cb4e6db8, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &658036871 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 658036872} + - component: {fileID: 658036873} + m_Layer: 0 + m_Name: testAsset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &658036872 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 658036871} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1776585307} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &658036873 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 658036871} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7eca106fdb3561d4087b806531422d67, type: 3} + m_Name: + m_EditorClassIdentifier: + lat: 53.245072 + lon: 5.860219 + prefab: {fileID: 2318991450609453006, guid: 4304b289e9966db478ec0bebd2d7e5ef, type: 3} --- !u!1001 &675407186 PrefabInstance: m_ObjectHideFlags: 0 @@ -2316,6 +2363,38 @@ MonoBehaviour: m_EditorClassIdentifier: m_Padding: {x: -8, y: -5, z: -8, w: -5} m_Softness: {x: 0, y: 0} +--- !u!1 &1776585306 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1776585307} + m_Layer: 0 + m_Name: kerstAssets + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1776585307 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776585306} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 149.04837, y: -42.458233, z: -4.4114265} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 658036872} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2058067599 GameObject: m_ObjectHideFlags: 0 @@ -2539,22 +2618,22 @@ PrefabInstance: - target: {fileID: 3849934062868920522, guid: 5fbb7c7c8ec47e849afba1b658f3e07e, type: 3} propertyPath: m_LocalRotation.w - value: 0.19788009 + value: 0.19789146 objectReference: {fileID: 0} - target: {fileID: 3849934062868920522, guid: 5fbb7c7c8ec47e849afba1b658f3e07e, type: 3} propertyPath: m_LocalRotation.x - value: 0.0826188 + value: 0.08262601 objectReference: {fileID: 0} - target: {fileID: 3849934062868920522, guid: 5fbb7c7c8ec47e849afba1b658f3e07e, type: 3} propertyPath: m_LocalRotation.y - value: 0.9013314 + value: 0.90132475 objectReference: {fileID: 0} - target: {fileID: 3849934062868920522, guid: 5fbb7c7c8ec47e849afba1b658f3e07e, type: 3} propertyPath: m_LocalRotation.z - value: -0.37632343 + value: -0.37633187 objectReference: {fileID: 0} - target: {fileID: 3919916255551741050, guid: 5fbb7c7c8ec47e849afba1b658f3e07e, type: 3} @@ -10429,3 +10508,4 @@ SceneRoots: - {fileID: 311190676} - {fileID: 2997518761711757160} - {fileID: 2058067601} + - {fileID: 1776585307} diff --git a/Assets/Scriptables/Projects/CurrentProject.asset b/Assets/Scriptables/Projects/CurrentProject.asset index b4eb00be..08bb5736 100644 --- a/Assets/Scriptables/Projects/CurrentProject.asset +++ b/Assets/Scriptables/Projects/CurrentProject.asset @@ -16,9 +16,9 @@ MonoBehaviour: SavedTimestamp: 20241008130521 UUID: 6a9f1798-d710-4956-96da-f109deb1487c CameraRotation: - - 29.956546783447266 - - 227.018310546875 - - 0 + - 30.000179290771484 + - 93.49939727783203 + - 0.0002218172885477543 UseCurrentTime: 0 functionalities: - Id: terrein diff --git a/Assets/Scripts/KerstSpecial/RaceController.cs b/Assets/Scripts/KerstSpecial/RaceController.cs index 6a3afea3..5b2b9029 100644 --- a/Assets/Scripts/KerstSpecial/RaceController.cs +++ b/Assets/Scripts/KerstSpecial/RaceController.cs @@ -56,6 +56,7 @@ public class RaceController : MonoBehaviour private MeshCollider nothingMeshCollider; private GameObject currentCheckpoint; private GameObject[] zoneObjects = new GameObject[4]; + private GameObject finishObject; private void Start() { @@ -69,6 +70,7 @@ private void Start() GetCoordinatesForRoute(); GenerateZones(); + GenerateFinish(); InitPlayer(); nothingMeshCollider = FindObjectOfType().gameObject.GetComponent(); @@ -107,9 +109,13 @@ private IEnumerator StartAnimationLoop() } } - private void OnFinish() + private void OnFinish(Collider col, ZoneTrigger trigger) { - + if(col == player.GetComponent()) + { + //finish + Debug.Log("Player finished"); + } } private void InitPlayer() @@ -396,6 +402,24 @@ private void GenerateZones() } } + private void GenerateFinish() + { + finishObject = new GameObject("finish"); + ZoneTrigger finishTrigger = finishObject.AddComponent(); + finishTrigger.OnEnter += OnFinish; + WorldTransform wt = finishObject.AddComponent(); + GameObjectWorldTransformShifter shifter = finishObject.AddComponent(); + wt.SetShifter(shifter); + BoxCollider bc = finishObject.AddComponent(); + bc.isTrigger = true; + finishObject.transform.localScale = new Vector3(100, 100, 10); + finishObject.transform.rotation = Quaternion.AngleAxis(90, Vector3.up); + Coordinate nextCoord = new Coordinate(CoordinateSystem.WGS84, routeCoords[routeCoords.Count -1].x, routeCoords[routeCoords.Count -1].y, 0); + Vector3 unityCoord = nextCoord.ToUnity(); + unityCoord.y = 3; + finishObject.transform.position = unityCoord; + } + private GameObject SpawnCheckpoint(Coordinate coord) { GameObject routeObject = GameObject.CreatePrimitive(PrimitiveType.Cube); diff --git a/Assets/Scripts/KerstSpecial/Sphere.prefab b/Assets/Scripts/KerstSpecial/Sphere.prefab new file mode 100644 index 00000000..55216534 --- /dev/null +++ b/Assets/Scripts/KerstSpecial/Sphere.prefab @@ -0,0 +1,107 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2318991450609453006 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7134678177087275454} + - component: {fileID: 7587559834630358888} + - component: {fileID: 8579847629058513816} + - component: {fileID: 7471204519832016439} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7134678177087275454 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2318991450609453006} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7587559834630358888 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2318991450609453006} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8579847629058513816 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2318991450609453006} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!135 &7471204519832016439 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2318991450609453006} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/KerstSpecial/Sphere.prefab.meta b/Assets/Scripts/KerstSpecial/Sphere.prefab.meta new file mode 100644 index 00000000..e387ce4f --- /dev/null +++ b/Assets/Scripts/KerstSpecial/Sphere.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4304b289e9966db478ec0bebd2d7e5ef +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/KerstSpecial/WorldAsset.cs b/Assets/Scripts/KerstSpecial/WorldAsset.cs new file mode 100644 index 00000000..2b28f142 --- /dev/null +++ b/Assets/Scripts/KerstSpecial/WorldAsset.cs @@ -0,0 +1,48 @@ +using Netherlands3D.Coordinates; +using Netherlands3D.Twin.FloatingOrigin; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Netherlands3D.Twin +{ + public class WorldAsset : MonoBehaviour + { + public double lat; + public double lon; + public float YRotation; + + public GameObject prefab; + private bool grounded = false; + + // Start is called before the first frame update + void Start() + { + Coordinate nextCoord = new Coordinate(CoordinateSystem.WGS84, lat, lon, 0); + Vector3 unityCoord = nextCoord.ToUnity(); + transform.position = unityCoord; + + prefab = Instantiate(prefab); + WorldTransform wt = prefab.AddComponent(); + GameObjectWorldTransformShifter shifter = prefab.AddComponent(); + wt.SetShifter(shifter); + prefab.transform.position = transform.position; + prefab.transform.rotation = Quaternion.AngleAxis(YRotation, Vector3.up); + } + + // Update is called once per frame + void Update() + { + if (!grounded) + { + RaycastHit hit; + if (Physics.Raycast(Vector3.up * 100, Vector3.down * 1000, out hit)) + { + Vector3 pos = prefab.transform.position; + prefab.transform.position = new Vector3(pos.x, hit.point.y, pos.z); + grounded = true; + } + } + } + } +} diff --git a/Assets/Scripts/KerstSpecial/WorldAsset.cs.meta b/Assets/Scripts/KerstSpecial/WorldAsset.cs.meta new file mode 100644 index 00000000..ef4ebd31 --- /dev/null +++ b/Assets/Scripts/KerstSpecial/WorldAsset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7eca106fdb3561d4087b806531422d67 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: