比较提交

...
此合并请求有变更与目标分支冲突。
/Project/Assets/ML-Agents/Examples/Tennis/Scenes/Tennis.unity
/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs
/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs.meta

2 次代码提交

作者 SHA1 备注 提交日期
bhh 5262c14f update model 5 年前
bhh 0a46fc45 added new models 5 年前
共有 4 个文件被更改,包括 1052 次插入0 次删除
  1. 962
      Project/Assets/ML-Agents/Examples/Tennis/Scenes/Tennis.unity
  2. 71
      Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs
  3. 11
      Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs.meta
  4. 8
      Project/ProjectSettings/NetworkManager.asset

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

71
Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs


//Standardized movement controller for the Agent Cube
using UnityEngine;
public class TennisRacketMovement : MonoBehaviour
{
[Header("RUNNING")] public ForceMode runningForceMode = ForceMode.Impulse;
//speed agent can run if grounded
public float agentRunSpeed = 20;
//speed agent can run if not grounded
public float agentRunInAirSpeed = 10f;
[Header("IDLE")]
//coefficient used to dampen velocity when idle
//the purpose of this is to fine tune agent drag
//...and prevent the agent sliding around while grounded
//0 means it will instantly stop when grounded
//1 means no drag will be applied
public float agentIdleDragVelCoeff = .85f;
[Header("BODY ROTATION")]
//body rotation speed
public float agentRotationSpeed = 7f;
[Header("JUMPING")]
//upward jump velocity magnitude
public float agentJumpVelocity = 15f;
[Header("FALLING FORCE")]
//force applied to agent while falling
public float agentFallingSpeed = 50f;
public void Jump(Rigidbody rb)
{
Vector3 velToUse = rb.velocity;
velToUse.y = agentJumpVelocity;
rb.velocity = velToUse;
}
public void RotateBody(Rigidbody rb, Vector3 rotationAxis)
{
rb.MoveRotation(rb.rotation * Quaternion.AngleAxis(agentRotationSpeed, rotationAxis));
}
public void RunOnGround(Rigidbody rb, Vector3 dir)
{
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunSpeed - vel, 0, agentRunSpeed);
rb.AddForce(dir.normalized * adjustedSpeed,
runningForceMode);
}
public void RunInAir(Rigidbody rb, Vector3 dir)
{
var vel = rb.velocity.magnitude;
float adjustedSpeed = Mathf.Clamp(agentRunInAirSpeed - vel, 0, agentRunInAirSpeed);
rb.AddForce(dir.normalized * adjustedSpeed,
runningForceMode);
}
public void AddIdleDrag(Rigidbody rb)
{
rb.velocity *= agentIdleDragVelCoeff;
}
public void AddFallingForce(Rigidbody rb)
{
rb.AddForce(
Vector3.down * agentFallingSpeed, ForceMode.Acceleration);
}
}

11
Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisRacketMovement.cs.meta


fileFormatVersion: 2
guid: d906a741b85c5445589e3c6d171a90cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Project/ProjectSettings/NetworkManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!149 &1
NetworkManager:
m_ObjectHideFlags: 0
m_DebugLevel: 0
m_Sendrate: 15
m_AssetToPrefab: {}
正在加载...
取消
保存