浏览代码

rebuilt crawler ragdoll to scale of 1

/hh-develop-ragdoll-testing
HH 5 年前
当前提交
7f9b9567
共有 4 个文件被更改,包括 1114 次插入669 次删除
  1. 775
      Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab
  2. 3
      Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab.meta
  3. 977
      Project/Assets/ML-Agents/Examples/Crawler/Scenes/CrawlerDynamicTarget.unity
  4. 28
      Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs

775
Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab
文件差异内容过多而无法显示
查看文件

3
Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab.meta


fileFormatVersion: 2
guid: 0058b366f9d6d44a3ba35beb06b0174b
NativeFormatImporter:
PrefabImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

977
Project/Assets/ML-Agents/Examples/Crawler/Scenes/CrawlerDynamicTarget.unity
文件差异内容过多而无法显示
查看文件

28
Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs


public Transform leg3Lower;
[Header("Joint Settings")] [Space(10)] JointDriveController m_JdController;
Vector3 m_DirToTarget;
float m_MovingTowardsDot;
float m_FacingDot;

public override void Initialize()
{
//Spawn an orientation cube
Vector3 oCubePos = hips.position;
Vector3 oCubePos = body.position;
m_DirToTarget = target.position - body.position;
//Setup each body part
m_JdController.SetupBodyPart(body);

/// </summary>
void RewardFunctionMovingTowards()
{
m_MovingTowardsDot = Vector3.Dot(m_JdController.bodyPartsDict[body].rb.velocity, m_DirToTarget.normalized);
m_MovingTowardsDot = Vector3.Dot(m_OrientationCube.transform.forward, m_JdController.bodyPartsDict[body].rb.velocity);
AddReward(0.03f * m_MovingTowardsDot);
}

void RewardFunctionFacingTarget()
{
m_FacingDot = Vector3.Dot(m_DirToTarget.normalized, body.forward);
AddReward(0.01f * m_FacingDot);
AddReward(0.01f * Vector3.Dot(m_OrientationCube.transform.forward, body.forward));
}
/// <summary>

/// </summary>
public override void OnEpisodeBegin()
{
if (m_DirToTarget != Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(m_DirToTarget);
}
transform.Rotate(Vector3.up, Random.Range(0.0f, 360.0f));
transform.Rotate(Vector3.up, Random.Range(0.0f, 360.0f));
}
}
private void OnDrawGizmosSelected()
{
if (Application.isPlaying)
{
Gizmos.color = Color.green;
Gizmos.matrix = m_OrientationCube.transform.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, m_OrientationCube.transform.localScale);
Gizmos.DrawRay(Vector3.zero, Vector3.forward);
}
}
}
正在加载...
取消
保存