Browse Source

added starting position wp

main
cailean 7 months ago
parent
commit
441544d124
  1. 2
      Assets/12_Timelines/Chair Animations.playable
  2. 94
      Assets/6_Scenes/Beep.unity
  3. 5
      Assets/7_Scripts/Waypoint/Waypoint.cs
  4. 14
      Assets/7_Scripts/Waypoint/WaypointManager.cs
  5. 2
      Assets/ML-Agents/Timers/Beep_timers.json

2
Assets/12_Timelines/Chair Animations.playable

@ -58,7 +58,7 @@ MonoBehaviour:
m_Version: 3
m_AnimClip: {fileID: 0}
m_Locked: 0
m_Muted: 0
m_Muted: 1
m_CustomPlayableFullTypename:
m_Curves: {fileID: 0}
m_Parent: {fileID: 11400000}

94
Assets/6_Scenes/Beep.unity

@ -234,7 +234,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 83569712}
serializedVersion: 2
m_LocalRotation: {x: 0.053030312, y: 0.8419763, z: -0.084204845, w: 0.53025776}
m_LocalRotation: {x: -0.12787408, y: 0.45540848, z: -0.06628496, w: -0.87855434}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -320,7 +320,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 155411616}
serializedVersion: 2
m_LocalRotation: {x: 0.08458105, y: 0.8354503, z: -0.13430305, w: 0.52614784}
m_LocalRotation: {x: -0.1800774, y: 0.45064092, z: -0.09334513, w: -0.86935705}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -780,7 +780,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 377437129}
serializedVersion: 2
m_LocalRotation: {x: -0.03783877, y: 0.8817097, z: -0.07178479, w: -0.46476156}
m_LocalRotation: {x: -0.037838772, y: 0.8817097, z: -0.071784794, w: -0.46476156}
m_LocalPosition: {x: -128.4, y: 13, z: -248.6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -897,7 +897,7 @@ PrefabInstance:
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
propertyPath: m_LocalPosition.x
value: -270.36
value: -264.41
objectReference: {fileID: 0}
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
@ -907,7 +907,7 @@ PrefabInstance:
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
propertyPath: m_LocalPosition.z
value: 556.31
value: 548.08997
objectReference: {fileID: 0}
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
@ -1212,8 +1212,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 470663197}
serializedVersion: 2
m_LocalRotation: {x: 0.14886537, y: -0.40094745, z: 0.06620899, w: 0.9014969}
m_LocalPosition: {x: -8.840607, y: -2.2873554, z: 38.56598}
m_LocalRotation: {x: 0.024272094, y: 0.9667496, z: -0.10028434, w: 0.23398508}
m_LocalPosition: {x: -10.898407, y: -3.3373547, z: 39.527832}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -1377,8 +1377,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 513050371}
serializedVersion: 2
m_LocalRotation: {x: 0.11435656, y: -0.52070224, z: 0.07062782, w: 0.84309155}
m_LocalPosition: {x: -8.582123, y: -2.2773552, z: 38.099243}
m_LocalRotation: {x: -0.0021003054, y: 0.9872027, z: -0.15892218, w: -0.013046807}
m_LocalPosition: {x: -10.910095, y: -3.3273544, z: 40.109375}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -2086,7 +2086,7 @@ Transform:
m_GameObject: {fileID: 1124157896}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0.97678393, z: -0, w: 0.21422696}
m_LocalPosition: {x: -8.840607, y: -2.2873554, z: 38.56598}
m_LocalPosition: {x: -10.898407, y: -3.3373547, z: 39.527832}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -2279,7 +2279,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1178814724}
serializedVersion: 2
m_LocalRotation: {x: 0.09656285, y: 0.7946739, z: -0.13122557, w: 0.584764}
m_LocalRotation: {x: -0.09275636, y: 0.43565673, z: -0.04519219, w: -0.89417964}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2578,17 +2578,17 @@ PrefabInstance:
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.x
value: -271.58
value: -264.41
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.y
value: 7.48
value: 6.4300003
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.z
value: 560.06
value: 548.08997
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
@ -2625,6 +2625,21 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5732046185206465305, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5732046185206465305, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5732046185206465305, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5777259271730693716, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_Name
@ -3172,6 +3187,18 @@ MonoBehaviour:
- {fileID: 377437131}
- {fileID: 513050373}
m_CMBrain: {fileID: 470663204}
--- !u!114 &1822302064 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5682263026450292309, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
m_PrefabInstance: {fileID: 2794896440572570268}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a5c81c2052c91a74a8d9fae388fca038, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1882797708
GameObject:
m_ObjectHideFlags: 3
@ -3688,18 +3715,48 @@ PrefabInstance:
- target: {fileID: 1170441306195283109, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.x
value: -37.46
value: -31.51
objectReference: {fileID: 0}
- target: {fileID: 1170441306195283109, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.z
value: 132.85
value: 124.63
objectReference: {fileID: 0}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_Agent
value:
objectReference: {fileID: 1412792148}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_Target
value:
objectReference: {fileID: 387060610}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_CurrentWaypoint
value:
objectReference: {fileID: 1822302064}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_WaypointList.Array.size
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_WaypointArray.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: 'm_WaypointList.Array.data[0]'
value:
objectReference: {fileID: 1822302064}
- target: {fileID: 3428618077651019461, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: 'm_WaypointArray.Array.data[0]'
value:
objectReference: {fileID: 1822302064}
- target: {fileID: 3582199055929070180, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_IsActive
@ -3715,6 +3772,11 @@ PrefabInstance:
propertyPath: m_Name
value: Waypoints
objectReference: {fileID: 0}
- target: {fileID: 5682263026450292309, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_StartingPosition
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8202717142006031211, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.x

5
Assets/7_Scripts/Waypoint/Waypoint.cs

@ -8,7 +8,7 @@ using UnityEngine.Events;
[ExecuteInEditMode]
public class Waypoint : MonoBehaviour
{
public bool m_StartingPosition;
[HideInInspector]
public Transform m_WaypointPosition;
@ -21,6 +21,8 @@ public class Waypoint : MonoBehaviour
public bool m_Touched;
public delegate void WaypointReached(float index, string modelName);
public static event WaypointReached OnWaypointReached;
@ -30,6 +32,7 @@ public class Waypoint : MonoBehaviour
m_WaypointPosition = this.transform;
}
void OnTriggerEnter(Collider other)
{
if (other.transform.CompareTag("agent"))

14
Assets/7_Scripts/Waypoint/WaypointManager.cs

@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.MLAgents;
using UnityEngine;
[ExecuteInEditMode]
@ -18,9 +19,13 @@ public class WaypointManager : MonoBehaviour
[SerializeField]
public Transform m_Target;
private Vector3 m_StartingPosition;
[SerializeField]
public Waypoint m_CurrentWaypoint;
public Transform m_Agent;
public delegate void SwapModelOnReachingWaypoint(string modelName);
public static event SwapModelOnReachingWaypoint SwapModelOnWaypointReached;
@ -124,12 +129,21 @@ public class WaypointManager : MonoBehaviour
if ( wp.isActiveAndEnabled )
{
m_WaypointList.Add(wp);
if (wp.m_StartingPosition)
m_StartingPosition = wp.transform.position;
}
}
MoveAgentToStartPosition();
m_WaypointList = m_WaypointList.OrderBy(waypoint => waypoint.m_Index).ToList();
}
private void MoveAgentToStartPosition()
{
m_Agent.position = m_StartingPosition;
Debug.Log($"Moved agent to {m_StartingPosition}");
}
private void CheckOverride()
{
if(Input.GetKeyUp(KeyCode.F))

2
Assets/ML-Agents/Timers/Beep_timers.json

@ -1 +1 @@
{"count":1,"self":37.216780799999995,"total":37.7969684,"children":{"InitializeActuators":{"count":1,"self":0.0010042999999999999,"total":0.0010042999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.0020039,"total":0.0020039,"children":null},"AgentSendState":{"count":1586,"self":0.026898699999999998,"total":0.055844899999999996,"children":{"CollectObservations":{"count":318,"self":0.010289399999999999,"total":0.010289399999999999,"children":null},"WriteActionMask":{"count":318,"self":0.0025111,"total":0.0025111,"children":null},"RequestDecision":{"count":318,"self":0.0161457,"total":0.0161457,"children":null}}},"DecideAction":{"count":1586,"self":0.3989319,"total":0.5114659,"children":{"RayPerceptionSensor.Perceive":{"count":318,"self":0.112534,"total":0.112534,"children":null}}},"AgentAct":{"count":1586,"self":0.0098687999999999988,"total":0.0098687999999999988,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710350886","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710350924"}}
{"count":1,"self":16.8422816,"total":17.0423705,"children":{"InitializeActuators":{"count":1,"self":0.0005094,"total":0.0005094,"children":null},"InitializeSensors":{"count":1,"self":0.0020168,"total":0.0020168,"children":null},"AgentSendState":{"count":549,"self":0.0065413,"total":0.0276907,"children":{"CollectObservations":{"count":110,"self":0.0035136,"total":0.0035136,"children":null},"WriteActionMask":{"count":110,"self":0,"total":0,"children":null},"RequestDecision":{"count":110,"self":0.0176358,"total":0.0176358,"children":null}}},"DecideAction":{"count":549,"self":0.1663493,"total":0.16685429999999998,"children":{"RayPerceptionSensor.Perceive":{"count":110,"self":0.000505,"total":0.000505,"children":null}}},"AgentAct":{"count":549,"self":0.0025093,"total":0.0025093,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710351915","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710351932"}}
Loading…
Cancel
Save