footstep audio added
This commit is contained in:
@@ -36,7 +36,8 @@ public class SensorObservations : MonoBehaviour, IOnSensorCollision
|
||||
SensorIsInTouch[idx] = 1f;
|
||||
}
|
||||
}
|
||||
public void OnSensorCollisionExit(Collider sensorCollider, GameObject other)
|
||||
|
||||
public void OnSensorCollisionExit(Collider sensorCollider, GameObject other)
|
||||
{
|
||||
//if (string.Compare(other.gameObject.name, "Terrain", true) !=0)
|
||||
if (other.layer != LayerMask.NameToLayer("Ground"))
|
||||
@@ -48,4 +49,5 @@ public class SensorObservations : MonoBehaviour, IOnSensorCollision
|
||||
SensorIsInTouch[idx] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Unity.MLAgents
|
||||
public interface IOnSensorCollision
|
||||
{
|
||||
void OnSensorCollisionEnter(Collider sensorCollider, GameObject other);
|
||||
void OnSensorCollisionExit(Collider sensorCollider, GameObject other);
|
||||
|
||||
void OnSensorCollisionExit(Collider sensorCollider, GameObject other);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,9 @@ namespace Unity.MLAgents
|
||||
if (_marathonAgent != null)
|
||||
_marathonAgent.SensorCollisionEnter(_collider, other);
|
||||
if (_onSensorCollision != null)
|
||||
{
|
||||
_onSensorCollision.OnSensorCollisionEnter(_collider, other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void OnCollisionExit(Collision other)
|
||||
@@ -35,7 +37,11 @@ namespace Unity.MLAgents
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (_onSensorCollision != null)
|
||||
{
|
||||
_onSensorCollision.OnSensorCollisionEnter(_collider, other.gameObject);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
@@ -46,6 +52,17 @@ namespace Unity.MLAgents
|
||||
{
|
||||
if (_onSensorCollision != null)
|
||||
_onSensorCollision.OnSensorCollisionEnter(_collider, other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void FootCheck(Collision sensor)
|
||||
{
|
||||
Debug.Log($"{sensor}");
|
||||
if (sensor.gameObject.name == "right_foot_heal_senor_l" || sensor.gameObject.name == "left_foot_heal_senor_l")
|
||||
{
|
||||
float collision = sensor.relativeVelocity.magnitude;
|
||||
Debug.Log($"{collision}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user