V2.6 change Ray Tag result as Onehot
change Ray Tag result as Onehot, Observation State: -targetStates 6 -inTargetArea 1 -remainTime 1 -gunReady 1 -my Obs 4 -tag onehot 19*2 -tag dis 19
This commit is contained in:
parent
9b2ba7fb46
commit
64ada808de
@ -1 +1 @@
|
||||
{"count":1,"self":7.6010208,"total":7.7934259,"children":{"InitializeActuators":{"count":16,"self":0.001499,"total":0.001499,"children":null},"InitializeSensors":{"count":16,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":138,"self":0.002006,"total":0.0155275,"children":{"CollectObservations":{"count":1104,"self":0.010023899999999999,"total":0.010023899999999999,"children":null},"WriteActionMask":{"count":1104,"self":0.0015048,"total":0.0015048,"children":null},"RequestDecision":{"count":1104,"self":0.0019928,"total":0.0019928,"children":null}}},"DecideAction":{"count":138,"self":0.0055068,"total":0.0055068,"children":null},"AgentAct":{"count":138,"self":0.1678665,"total":0.1678665,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1670578612","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-_qjpya-1B8A6Gvs6pbjAv -hubSessionId 13566e90-76f5-11ed-81d5-5bc0486f82d5 -accessToken qw1R29ZQd77wYz840DIgO8Mcql8NgyzciHRCP0pk3Ls00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"InGame","end_time_seconds":"1670578620"}}
|
||||
{"count":1,"self":15.2624832,"total":16.0374865,"children":{"InitializeActuators":{"count":16,"self":0.0020017999999999998,"total":0.0020017999999999998,"children":null},"InitializeSensors":{"count":16,"self":0.0020989999999999997,"total":0.0020989999999999997,"children":null},"AgentSendState":{"count":547,"self":0.0070130999999999995,"total":0.034057899999999995,"children":{"CollectObservations":{"count":4376,"self":0.0200301,"total":0.0200301,"children":null},"WriteActionMask":{"count":4376,"self":0.0015003,"total":0.0015003,"children":null},"RequestDecision":{"count":4376,"self":0.0055144,"total":0.0055144,"children":null}}},"DecideAction":{"count":547,"self":0.0085414999999999987,"total":0.0085414999999999987,"children":null},"AgentAct":{"count":547,"self":0.72779699999999992,"total":0.72779699999999992,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1670633960","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-BIduOqLJT8GiF8SNWhGj_ -hubSessionId e2ebfc30-77ac-11ed-bf56-45d250d830d4 -accessToken aCi_2ERt33bo42jVTu8X3P-PvUkABd5hiU-fyHtjEnA00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"InGame","end_time_seconds":"1670633976"}}
|
@ -2406,7 +2406,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -2454,6 +2454,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &86413631
|
||||
MonoBehaviour:
|
||||
@ -2474,13 +2475,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 1159571854}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &86413632
|
||||
@ -13044,7 +13046,7 @@ Mesh:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh189752
|
||||
m_Name: pb_Mesh130832
|
||||
serializedVersion: 10
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
@ -16806,7 +16808,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -16854,6 +16856,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &629870341
|
||||
MonoBehaviour:
|
||||
@ -16874,13 +16877,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 1054491405}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &629870342
|
||||
@ -23915,7 +23919,7 @@ Mesh:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh189648
|
||||
m_Name: pb_Mesh130728
|
||||
serializedVersion: 10
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
@ -24969,7 +24973,7 @@ Mesh:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh193258
|
||||
m_Name: pb_Mesh134378
|
||||
serializedVersion: 10
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
@ -28794,7 +28798,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -28842,6 +28846,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1040515778
|
||||
MonoBehaviour:
|
||||
@ -28862,13 +28867,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 1360499123}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1040515779
|
||||
@ -36835,7 +36841,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -36883,6 +36889,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1379895155
|
||||
MonoBehaviour:
|
||||
@ -36903,13 +36910,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 292511581}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1379895156
|
||||
@ -38757,7 +38765,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -38805,6 +38813,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1463948060
|
||||
MonoBehaviour:
|
||||
@ -38825,13 +38834,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 1560580715}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1463948061
|
||||
@ -39523,7 +39533,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -39571,6 +39581,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1490348734
|
||||
MonoBehaviour:
|
||||
@ -39591,13 +39602,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 618792061}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1490348735
|
||||
@ -40693,7 +40705,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -40741,6 +40753,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1527717524
|
||||
MonoBehaviour:
|
||||
@ -40761,13 +40774,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 1724835459}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1527717525
|
||||
@ -45521,7 +45535,7 @@ Mesh:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh189800
|
||||
m_Name: pb_Mesh130880
|
||||
serializedVersion: 10
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
@ -51108,7 +51122,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 39
|
||||
VectorObservationSize: 70
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 1
|
||||
@ -51156,6 +51170,7 @@ MonoBehaviour:
|
||||
mouseXSensitivity: 100
|
||||
mouseYSensitivity: 200
|
||||
yRotation: 0.1
|
||||
oneHotRayTag: 1
|
||||
defaultTPCamera: 1
|
||||
--- !u!114 &1834289471
|
||||
MonoBehaviour:
|
||||
@ -51176,13 +51191,14 @@ MonoBehaviour:
|
||||
agentCanvas: {fileID: 450578166}
|
||||
viewDistance: 100
|
||||
focusRange: 0.15
|
||||
halfOuterRayNum: 5
|
||||
focusRayNum: 3
|
||||
halfOuterRayNum: 7
|
||||
focusRayNum: 5
|
||||
showInGameRay: 1
|
||||
showDebugRay: 0
|
||||
showInGameRayInfo: 1
|
||||
lineWidth: 0.05
|
||||
rayTagResult: []
|
||||
rayTagResultOneHot: []
|
||||
rayDisResult: []
|
||||
inViewEnemies: []
|
||||
--- !u!143 &1834289472
|
||||
|
@ -42,6 +42,7 @@ public class AgentWithGun : Agent
|
||||
public float yRotation = 0.1f;//定义一个浮点类型的量,记录‘围绕’X轴旋转的角度
|
||||
|
||||
[Header("Env")]
|
||||
public bool oneHotRayTag = true;
|
||||
private List<float> spinRecord = new List<float>();
|
||||
private bool lockMouse;
|
||||
private float Damage;
|
||||
@ -418,6 +419,7 @@ public override void OnEpisodeBegin()
|
||||
{
|
||||
EnvUICon.initChart();
|
||||
}
|
||||
rayScript.updateRayInfo(); // update raycast
|
||||
}
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// 观察情报
|
||||
@ -426,11 +428,13 @@ public override void CollectObservations(VectorSensor sensor)
|
||||
//List<float> enemyLDisList = RaySensors.enemyLDisList;// All Enemy Lside Distances
|
||||
//List<float> enemyRDisList = RaySensors.enemyRDisList;// All Enemy Rside Distances
|
||||
|
||||
float[] myObserve = { transform.localPosition.x, transform.localPosition.y, transform.localPosition.z, transform.eulerAngles.y };
|
||||
float[] myObserve = { transform.localPosition.x, transform.localPosition.y, transform.localPosition.z, transform.eulerAngles.y/360f };
|
||||
float[] rayTagResult = rayScript.rayTagResult;// 探测用RayTag结果 float[](raySensorNum,1)
|
||||
float[] rayTagResultOnehot = rayScript.rayTagResultOneHot.ToArray(); // 探测用RayTagonehot结果 List<int>[](raySensorNum*Tags,1)
|
||||
float[] rayDisResult = rayScript.rayDisResult; // 探测用RayDis结果 float[](raySensorNum,1)
|
||||
float[] targetStates = targetCon.targetState; // (6) targettype, target x,y,z, firebasesAreaDiameter
|
||||
float remainTime = targetCon.leftTime;
|
||||
gunReadyToggle = gunReady();
|
||||
//float[] focusEnemyObserve = RaySensors.focusEnemyInfo;// 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
|
||||
|
||||
//sensor.AddObservation(allEnemyNum); // 敌人数量 int
|
||||
@ -439,11 +443,17 @@ public override void CollectObservations(VectorSensor sensor)
|
||||
sensor.AddObservation(remainTime); // (1)
|
||||
sensor.AddObservation(gunReadyToggle); //(1) save gun is ready?
|
||||
sensor.AddObservation(myObserve); // (4)自机位置xyz+朝向 float[](4,1)
|
||||
sensor.AddObservation(rayTagResult); // 探测用RayTag结果 float[](raySensorNum,1)
|
||||
if (oneHotRayTag)
|
||||
{
|
||||
sensor.AddObservation(rayTagResultOnehot); // 探测用RayTag结果 float[](raySensorNum,1)
|
||||
}
|
||||
else
|
||||
{
|
||||
sensor.AddObservation(rayTagResult);
|
||||
}
|
||||
sensor.AddObservation(rayDisResult); // 探测用RayDis结果 float[](raySensorNum,1)
|
||||
//sensor.AddObservation(focusEnemyObserve); // 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
|
||||
//sensor.AddObservation(raySensorNum); // raySensor数量 int
|
||||
gunReadyToggle = gunReady();
|
||||
//sensor.AddObservation(remainTime); // RemainTime int
|
||||
}
|
||||
|
||||
|
50
Assets/Script/InGame/Onehot.cs
Normal file
50
Assets/Script/InGame/Onehot.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class Onehot
|
||||
{
|
||||
private List<string> tags = new List<string>();
|
||||
public List<List<float>> onehot = new List<List<float>>();
|
||||
private float totalNum;
|
||||
public void initialize(List<string> inputTags)
|
||||
{
|
||||
tags = inputTags;
|
||||
totalNum = tags.Count;
|
||||
for (int i = 0; i < totalNum; i++)
|
||||
{
|
||||
List<float> thisOnehot = new List<float>();
|
||||
for (int j = 0; j < totalNum; j++) thisOnehot.Add(0f);
|
||||
thisOnehot[i] = 1f;
|
||||
onehot.Add(thisOnehot);
|
||||
}
|
||||
}
|
||||
public List<float> encoder(string name = null)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
List<float> allZeroOnehot = new List<float>();
|
||||
for (int j = 0; j < totalNum; j++) allZeroOnehot.Add(0);
|
||||
return allZeroOnehot;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return onehot[tags.IndexOf(name)];
|
||||
}catch(ArgumentOutOfRangeException)
|
||||
{
|
||||
List<float> allZeroOnehot = new List<float>();
|
||||
for (int j = 0; j < totalNum; j++) allZeroOnehot.Add(0);
|
||||
return allZeroOnehot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string decoder(List<float> thisOnehot)
|
||||
{
|
||||
return tags[onehot.IndexOf(thisOnehot)];
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc32b1477a6cda045910784943fbcfd5
|
||||
guid: cdb75d03525930d4caaefab4eaaf6e8a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/*该scrip用于创建复数条ray于视角内,并探测被ray射到的物体*/
|
||||
@ -28,6 +29,7 @@ public class RaySensors : MonoBehaviour
|
||||
|
||||
[Header("RayCastResult")]
|
||||
public float[] rayTagResult;
|
||||
public List<float> rayTagResultOneHot;
|
||||
public float[] rayDisResult;
|
||||
|
||||
[System.NonSerialized] public int totalRayNum;
|
||||
@ -37,6 +39,8 @@ public class RaySensors : MonoBehaviour
|
||||
LineRenderer[] lineRenderers;
|
||||
rayInfoUI[] rayInfoUIs;
|
||||
public List<GameObject> inViewEnemies = new List<GameObject>();
|
||||
private List<string> tags = new List<string> {"Wall","Enemy"};
|
||||
private Onehot oneHotTags = new Onehot();
|
||||
|
||||
|
||||
private void Start()
|
||||
@ -49,7 +53,8 @@ private void Start()
|
||||
lineRenderers = new LineRenderer[totalRayNum];
|
||||
rayInfoOBJ = new GameObject[totalRayNum];
|
||||
rayInfoUIs = new rayInfoUI[totalRayNum];
|
||||
for(int i = 0; i < totalRayNum; i++)
|
||||
oneHotTags.initialize(tags);
|
||||
for (int i = 0; i < totalRayNum; i++)
|
||||
{
|
||||
linesOBJ[i] = new GameObject();
|
||||
linesOBJ[i].name = "rayCastLine-" + Convert.ToString(i);
|
||||
@ -91,10 +96,12 @@ private void singleRaycastUpdate(Ray ray,LineRenderer thisLineRenderer,rayInfoUI
|
||||
if (Physics.Raycast(ray, out thisHit, viewDistance)) // 若在viewDistance范围内有碰撞
|
||||
{
|
||||
rayInfoText = thisHit.collider.tag;
|
||||
rayTagResult = tagToInt(thisHit.collider.tag);
|
||||
rayTagResult = tagToInt(rayInfoText);
|
||||
rayTagResultOneHot.AddRange(oneHotTags.encoder(rayInfoText));
|
||||
rayDisResult = thisHit.distance;
|
||||
lineLength = rayDisResult;
|
||||
rayInfoText += "\n" + Convert.ToString(rayDisResult);
|
||||
rayDisResult = rayDisResult / viewDistance; // Normalization!
|
||||
//输出log
|
||||
switch (rayTagResult)
|
||||
{
|
||||
@ -115,6 +122,7 @@ private void singleRaycastUpdate(Ray ray,LineRenderer thisLineRenderer,rayInfoUI
|
||||
}
|
||||
else // 若在viewDistance范围无碰撞
|
||||
{
|
||||
rayTagResultOneHot.AddRange(oneHotTags.encoder());
|
||||
rayTagResult = -1f;
|
||||
rayDisResult = -1f;
|
||||
//输出log
|
||||
@ -165,6 +173,7 @@ public void updateRayInfo()
|
||||
float focusREdge = agentCam.pixelWidth * (1 + focusRange) / 2;
|
||||
float thisCamPixelHeight = agentCam.pixelHeight;
|
||||
inViewEnemies.Clear();
|
||||
rayTagResultOneHot.Clear();
|
||||
for (int i = 0; i < halfOuterRayNum; i++) // create left outside rays; 0 ~ focusLeftEdge
|
||||
{
|
||||
Vector3 point = new Vector3(i * focusLEdge / (halfOuterRayNum - 1), thisCamPixelHeight / 2, 0);
|
||||
|
@ -1,18 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class sideChennelManager : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_PixelRect:
|
||||
serializedVersion: 2
|
||||
x: -1110
|
||||
y: -232
|
||||
x: -1073
|
||||
y: -689
|
||||
width: 1080
|
||||
height: 578
|
||||
height: 631
|
||||
m_ShowMode: 0
|
||||
m_Title: Game
|
||||
m_RootView: {fileID: 4}
|
||||
@ -38,12 +38,12 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_PixelRect:
|
||||
serializedVersion: 2
|
||||
x: -238
|
||||
y: 116
|
||||
x: -33
|
||||
y: 148
|
||||
width: 1840
|
||||
height: 1019
|
||||
m_ShowMode: 4
|
||||
m_Title: Hierarchy
|
||||
m_Title: Scene
|
||||
m_RootView: {fileID: 12}
|
||||
m_MinSize: {x: 875, y: 542}
|
||||
m_MaxSize: {x: 10000, y: 10000}
|
||||
@ -66,7 +66,7 @@ MonoBehaviour:
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1080
|
||||
height: 578
|
||||
height: 631
|
||||
m_MinSize: {x: 100, y: 121}
|
||||
m_MaxSize: {x: 4000, y: 4021}
|
||||
m_ActualView: {fileID: 16}
|
||||
@ -93,11 +93,11 @@ MonoBehaviour:
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1080
|
||||
height: 578
|
||||
height: 631
|
||||
m_MinSize: {x: 100, y: 121}
|
||||
m_MaxSize: {x: 4000, y: 4021}
|
||||
vertical: 0
|
||||
controlID: 133
|
||||
controlID: 57
|
||||
--- !u!114 &5
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -114,9 +114,9 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 586
|
||||
width: 1091
|
||||
height: 383
|
||||
y: 589
|
||||
width: 878
|
||||
height: 380
|
||||
m_MinSize: {x: 231, y: 271}
|
||||
m_MaxSize: {x: 10001, y: 10021}
|
||||
m_ActualView: {fileID: 18}
|
||||
@ -144,12 +144,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1091
|
||||
width: 878
|
||||
height: 969
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 159
|
||||
controlID: 126
|
||||
--- !u!114 &7
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -166,9 +166,9 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 375
|
||||
width: 276
|
||||
height: 594
|
||||
y: 655
|
||||
width: 500
|
||||
height: 314
|
||||
m_MinSize: {x: 102, y: 121}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
m_ActualView: {fileID: 22}
|
||||
@ -193,14 +193,14 @@ MonoBehaviour:
|
||||
- {fileID: 7}
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 1091
|
||||
x: 878
|
||||
y: 0
|
||||
width: 276
|
||||
width: 500
|
||||
height: 969
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 105
|
||||
controlID: 88
|
||||
--- !u!114 &9
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -218,8 +218,8 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 276
|
||||
height: 375
|
||||
width: 500
|
||||
height: 655
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 20}
|
||||
@ -252,7 +252,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 300, y: 200}
|
||||
m_MaxSize: {x: 24288, y: 16192}
|
||||
vertical: 0
|
||||
controlID: 158
|
||||
controlID: 125
|
||||
--- !u!114 &11
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -268,9 +268,9 @@ MonoBehaviour:
|
||||
m_Children: []
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 1367
|
||||
x: 1378
|
||||
y: 0
|
||||
width: 473
|
||||
width: 462
|
||||
height: 969
|
||||
m_MinSize: {x: 275, y: 50}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
@ -367,10 +367,10 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1091
|
||||
height: 586
|
||||
m_MinSize: {x: 201, y: 221}
|
||||
m_MaxSize: {x: 4001, y: 4021}
|
||||
width: 878
|
||||
height: 589
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 21}
|
||||
m_Panes:
|
||||
- {fileID: 21}
|
||||
@ -396,10 +396,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: -1110
|
||||
y: -232
|
||||
x: -1073
|
||||
y: -689
|
||||
width: 1080
|
||||
height: 557
|
||||
height: 610
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -410,7 +410,7 @@ MonoBehaviour:
|
||||
m_ShowGizmos: 0
|
||||
m_TargetDisplay: 0
|
||||
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_TargetSize: {x: 1080, y: 536}
|
||||
m_TargetSize: {x: 1080, y: 589}
|
||||
m_TextureFilterMode: 0
|
||||
m_TextureHideFlags: 61
|
||||
m_RenderIMGUI: 1
|
||||
@ -427,8 +427,8 @@ MonoBehaviour:
|
||||
vZoomLockedByDefault: 0
|
||||
m_HBaseRangeMin: -540
|
||||
m_HBaseRangeMax: 540
|
||||
m_VBaseRangeMin: -268
|
||||
m_VBaseRangeMax: 268
|
||||
m_VBaseRangeMin: -294.5
|
||||
m_VBaseRangeMax: 294.5
|
||||
m_HAllowExceedBaseRangeMin: 1
|
||||
m_HAllowExceedBaseRangeMax: 1
|
||||
m_VAllowExceedBaseRangeMin: 1
|
||||
@ -447,9 +447,9 @@ MonoBehaviour:
|
||||
x: 0
|
||||
y: 21
|
||||
width: 1080
|
||||
height: 536
|
||||
height: 589
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Translation: {x: 540, y: 268}
|
||||
m_Translation: {x: 540, y: 294.5}
|
||||
m_MarginLeft: 0
|
||||
m_MarginRight: 0
|
||||
m_MarginTop: 0
|
||||
@ -457,12 +457,12 @@ MonoBehaviour:
|
||||
m_LastShownAreaInsideMargins:
|
||||
serializedVersion: 2
|
||||
x: -540
|
||||
y: -268
|
||||
y: -294.5
|
||||
width: 1080
|
||||
height: 536
|
||||
height: 589
|
||||
m_MinimalGUI: 1
|
||||
m_defaultScale: 1
|
||||
m_LastWindowPixelSize: {x: 1080, y: 557}
|
||||
m_LastWindowPixelSize: {x: 1080, y: 610}
|
||||
m_ClearInEditMode: 1
|
||||
m_NoCameraWarning: 1
|
||||
m_LowResolutionForAspectRatios: 01000000000000000000
|
||||
@ -516,10 +516,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: -238
|
||||
y: 732
|
||||
width: 1090
|
||||
height: 362
|
||||
x: -33
|
||||
y: 767
|
||||
width: 877
|
||||
height: 359
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -537,22 +537,22 @@ MonoBehaviour:
|
||||
m_SkipHidden: 0
|
||||
m_SearchArea: 1
|
||||
m_Folders:
|
||||
- Assets
|
||||
- Assets/Script/InGame
|
||||
m_Globs: []
|
||||
m_OriginalText:
|
||||
m_ViewMode: 1
|
||||
m_StartGridSize: 16
|
||||
m_LastFolders:
|
||||
- Assets
|
||||
- Assets/Script/InGame
|
||||
m_LastFoldersGridSize: 16
|
||||
m_LastProjectPath: C:\Users\UCUNI\OneDrive\Unity\ML-Agents\Aimbot-ParallelEnv
|
||||
m_LockTracker:
|
||||
m_IsLocked: 0
|
||||
m_FolderTreeState:
|
||||
scrollPos: {x: 0, y: 50}
|
||||
m_SelectedIDs: b47c0000
|
||||
m_LastClickedID: 31924
|
||||
m_ExpandedIDs: 00000000b47c0000b67c0000b87c0000ba7c0000bc7c0000c87c0000d67c000000ca9a3b
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs: ea780000
|
||||
m_LastClickedID: 30954
|
||||
m_ExpandedIDs: 00000000a0780000a2780000a4780000a6780000a8780000e478000000ca9a3b
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -580,7 +580,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 00000000b47c0000b67c0000b87c0000ba7c0000bc7c0000
|
||||
m_ExpandedIDs: 00000000a0780000a2780000a4780000a6780000a8780000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -611,18 +611,18 @@ MonoBehaviour:
|
||||
m_ExpandedInstanceIDs: c623000000000000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name: EnvArgsChanger
|
||||
m_OriginalName: EnvArgsChanger
|
||||
m_Name:
|
||||
m_OriginalName:
|
||||
m_EditFieldRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 0
|
||||
height: 0
|
||||
m_UserData: 6552
|
||||
m_UserData: 0
|
||||
m_IsWaitingForDelay: 0
|
||||
m_IsRenaming: 0
|
||||
m_OriginalEventType: 0
|
||||
m_OriginalEventType: 11
|
||||
m_IsRenamingFilename: 1
|
||||
m_ClientGUIView: {fileID: 5}
|
||||
m_CreateAssetUtility:
|
||||
@ -635,7 +635,7 @@ MonoBehaviour:
|
||||
m_ScrollPosition: {x: 0, y: 0}
|
||||
m_GridSize: 16
|
||||
m_SkipHiddenPackages: 0
|
||||
m_DirectoriesAreaWidth: 355
|
||||
m_DirectoriesAreaWidth: 334
|
||||
--- !u!114 &19
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -656,9 +656,9 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 1129
|
||||
y: 146
|
||||
width: 472
|
||||
x: 1345
|
||||
y: 178
|
||||
width: 461
|
||||
height: 948
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
@ -697,10 +697,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 853
|
||||
y: 146
|
||||
width: 274
|
||||
height: 354
|
||||
x: 845
|
||||
y: 178
|
||||
width: 498
|
||||
height: 634
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -708,20 +708,20 @@ MonoBehaviour:
|
||||
m_SceneHierarchy:
|
||||
m_TreeViewState:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs: 0a960600fc99060032a1060018a10600e69e0600cc9f06001ea10600489d0600
|
||||
m_LastClickedID: 433480
|
||||
m_ExpandedIDs: 0206f8ff5a06f8ffb006f8ff1a0af8ff720af8fff40bf8ffd8b1f8ff34b2f8ff8ab2f8ffa0b4f8fff8b4f8ff7ab6f8ffe623f9ff4224f9ff9424f9ffe426f9ff4027f9ffe227f9ffa62cf9fffe2cf9ff7c2ef9ff8ee2fafffe98fbff5a99fbffda9afbff0a95ffff6895ffffea96ffffaef1ffff0cf2ffff8af3ffff58faffff6a4701006a4c010090df03007e210400a076040054370500827a050014810500ec8a0500
|
||||
m_SelectedIDs: fa41030048470300d64b030076420300683b03001c490300d24b0300
|
||||
m_LastClickedID: 216018
|
||||
m_ExpandedIDs: a84cfdff004dfdff804efdff2690fdffcc92fdffda6ffeff3870feffb871feff32fbffffaa010200ac040200ca400300
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name: EnemyNum
|
||||
m_OriginalName: EnemyNum
|
||||
m_Name: Enviroment-NonChart
|
||||
m_OriginalName: Enviroment-NonChart
|
||||
m_EditFieldRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 0
|
||||
height: 0
|
||||
m_UserData: -450832
|
||||
m_UserData: 131890
|
||||
m_IsWaitingForDelay: 0
|
||||
m_IsRenaming: 0
|
||||
m_OriginalEventType: 0
|
||||
@ -754,10 +754,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: -238
|
||||
y: 146
|
||||
width: 1090
|
||||
height: 565
|
||||
x: -33
|
||||
y: 178
|
||||
width: 877
|
||||
height: 568
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -987,14 +987,14 @@ MonoBehaviour:
|
||||
m_OverrideSceneCullingMask: 6917529027641081856
|
||||
m_SceneIsLit: 1
|
||||
m_SceneLighting: 1
|
||||
m_2DMode: 1
|
||||
m_2DMode: 0
|
||||
m_isRotationLocked: 0
|
||||
m_PlayAudio: 0
|
||||
m_AudioPlay: 0
|
||||
m_Position:
|
||||
m_Target: {x: 201, y: 517, z: 0}
|
||||
m_Target: {x: -37.653114, y: 49.920357, z: -199.11137}
|
||||
speed: 2
|
||||
m_Value: {x: 201, y: 517, z: 0}
|
||||
m_Value: {x: -37.653114, y: 49.920357, z: -199.11137}
|
||||
m_RenderMode: 0
|
||||
m_CameraMode:
|
||||
drawMode: 0
|
||||
@ -1023,17 +1023,17 @@ MonoBehaviour:
|
||||
m_Size: {x: 0, y: 0}
|
||||
yGrid:
|
||||
m_Fade:
|
||||
m_Target: 0
|
||||
m_Target: 1
|
||||
speed: 2
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
|
||||
m_Pivot: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
zGrid:
|
||||
m_Fade:
|
||||
m_Target: 1
|
||||
m_Target: 0
|
||||
speed: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
|
||||
m_Pivot: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
@ -1041,17 +1041,17 @@ MonoBehaviour:
|
||||
m_GridAxis: 1
|
||||
m_gridOpacity: 0.5
|
||||
m_Rotation:
|
||||
m_Target: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Target: {x: -0.41212952, y: -0.07448741, z: 0.033832584, w: -0.907449}
|
||||
speed: 2
|
||||
m_Value: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Value: {x: -0.412128, y: -0.074487135, z: 0.033832457, w: -0.90744567}
|
||||
m_Size:
|
||||
m_Target: 48.59578
|
||||
m_Target: 1.2315754
|
||||
speed: 2
|
||||
m_Value: 48.59578
|
||||
m_Value: 1.2315754
|
||||
m_Ortho:
|
||||
m_Target: 1
|
||||
m_Target: 0
|
||||
speed: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_CameraSettings:
|
||||
m_Speed: 1.0005
|
||||
m_SpeedNormalized: 0.5
|
||||
@ -1065,7 +1065,7 @@ MonoBehaviour:
|
||||
m_FarClip: 10000
|
||||
m_DynamicClip: 1
|
||||
m_OcclusionCulling: 0
|
||||
m_LastSceneViewRotation: {x: 0.3832387, y: -0.0063747955, z: 0.002596695, w: 0.92361826}
|
||||
m_LastSceneViewRotation: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226}
|
||||
m_LastSceneViewOrtho: 0
|
||||
m_ReplacementShader: {fileID: 0}
|
||||
m_ReplacementString:
|
||||
@ -1092,10 +1092,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 853
|
||||
y: 521
|
||||
width: 274
|
||||
height: 573
|
||||
x: 845
|
||||
y: 833
|
||||
width: 498
|
||||
height: 293
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
|
Loading…
Reference in New Issue
Block a user