浏览代码

Fixing agent reset, using Teleport api call for articulation. Velocities/angular velocities of articulations can't be reset yet.

/PhysXArticulations20201
Vilmantas Balasevicius 5 年前
当前提交
f38a6b9f
共有 3 个文件被更改,包括 72 次插入6 次删除
  1. 66
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Scenes/ArticulatedCrawlerManualControl.unity
  2. 4
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/ArticulatedCrawlerAgent.cs
  3. 8
      UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/ArticulatedJointDriveController.cs

66
UnitySDK/Assets/ML-Agents/Examples/Crawler/Scenes/ArticulatedCrawlerManualControl.unity


--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2

m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
m_LightingSettings: {fileID: 4890085278179872738, guid: c237d9a5f2c3ffcfb8d21ebf87e88002,
type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &162708877 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8600072863197404167, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
m_PrefabInstance: {fileID: 671491189}
m_PrefabAsset: {fileID: 0}
--- !u!1 &384922840 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 9138266637015102719, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
m_PrefabInstance: {fileID: 671491189}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &671491189
PrefabInstance:
m_ObjectHideFlags: 0

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2237312266892387086, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
propertyPath: m_Immovable
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7737080709538424164, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
--- !u!1 &728763377 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1608323988796809829, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
m_PrefabInstance: {fileID: 671491189}
m_PrefabAsset: {fileID: 0}
--- !u!1 &898447821 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1129387478859796, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
m_PrefabInstance: {fileID: 671491189}
m_PrefabAsset: {fileID: 0}
--- !u!114 &898447825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 898447821}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1183164ed37748bf9cc8441ceb64df13, type: 3}
m_Name:
m_EditorClassIdentifier:
upperLeg0: {fileID: 728763377}
upperLeg1: {fileID: 384922840}
foreLeg0: {fileID: 1541621532}
foreLeg1: {fileID: 162708877}
useAlternativeKeySetForInput: 0
maxJointForceLimit: 1000
maxJointSpring: 100
jointDampen: 30
currentStrength: 0
--- !u!1 &1193539137
GameObject:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1541621532 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8640153343578765727, guid: 1661ce2a8a3cdfd3480c3d24bddd72f2,
type: 3}
m_PrefabInstance: {fileID: 671491189}
m_PrefabAsset: {fileID: 0}

4
UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/ArticulatedCrawlerAgent.cs


{
if (m_DirToTarget != Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(m_DirToTarget);
body.transform.rotation = Quaternion.LookRotation(m_DirToTarget);
transform.Rotate(Vector3.up, Random.Range(0.0f, 360.0f));
body.transform.Rotate(Vector3.up, Random.Range(0.0f, 360.0f));
foreach (var bodyPart in m_JdController.bodyPartsDict.Values)
{

8
UnitySDK/Assets/ML-Agents/Examples/Crawler/Scripts/ArticulatedJointDriveController.cs


/// </summary>
public void Reset(ArticulationBodyPart bp)
{
bp.arb.transform.position = bp.startingPos;
bp.arb.transform.rotation = bp.startingRot;
// Can't assign transforms for articulation bodies: transform changes are ignored, simulations goes on.
// No way to reset velocities for articulation bodies now
if (bp.arb.isRoot)
bp.arb.TeleportRoot(bp.startingPos, bp.startingRot);
//bp.arb.transform.position = bp.startingPos;
//bp.arb.transform.rotation = bp.startingRot;
// Can't assigned articulation body velocitys/angularVelocities
//bp.arb.velocity = Vector3.zero;

正在加载...
取消
保存