Doyle Chase V6
實驗?zāi)繕?
1.進入靜立狀態(tài)後,進入追逐狀態(tài),在追逐狀態(tài)下,要能持續(xù)跑至接近目標的距離內(nèi)
2.動作引導(dǎo)為雙臂展開身體前傾的帥氣奔跑動作
實驗設(shè)計:
1.任何弱點觸地皆失敗 (尾巴和劍並非弱點)
2.if(weaknessOnGround){if(inferenceMode){brainMode = DoyleMode.GetUp;SetModel("DoyleGetUp", getUpBrain);behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}else{AddReward(-1f);judge.outLife++;judge.Reset();return;}}else if(doyleRoot.localPosition.y < -10f){if(inferenceMode){brainMode = DoyleMode.GetUp;SetModel("DoyleGetUp", getUpBrain);behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}else{AddReward(-1f);judge.outY++;judge.Reset();return;}}else{targetSmoothPosition = targetPositionBuffer.GetSmoothVal();headDir = targetSmoothPosition - stageBase.InverseTransformPoint(doyleHeadRb.position);rootDir = targetSmoothPosition - stageBase.InverseTransformPoint(doyleRootRb.position);flatTargetVelocity = rootDir;flatTargetVelocity.y = 0f;targetDistance = flatTargetVelocity.magnitude;lookAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleHead.up, headDir));upAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleHead.right * -1f, Vector3.up));aimVelocity = flatTargetVelocity.normalized;aimVelocity.y = 0.2f;//LeanVector3 leanDir = rootAimRot * flatTargetVelocity;spineUpAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleSpine.right * -1f, leanDir));rootUpAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleRoot.up, leanDir));//Naruto ArmVector3 flatLeftDir = Vector3.Cross(flatTargetVelocity, Vector3.up);leftUpperArmAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleLeftUpperArm.right, leftUpperArmAimRot * flatTargetVelocity));leftForeArmAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleLeftForeArm.right, leftForeArmAimRot * flatTargetVelocity));rightUpperArmAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleRightUpperArm.right, rightUpperArmAimRot * flatTargetVelocity));rightForeArmAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleRightForeArm.right, rightForeArmAimRot * flatTargetVelocity));swordAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleSword.up, swordAimRot * flatTargetVelocity));tail6Angle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleTail6.right, -1f * flatTargetVelocity));leftThighAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleLeftThigh.forward * -1f, flatLeftDir));rightThighAngle = Mathf.InverseLerp(180f, 0f, Vector3.Angle(doyleRightThigh.forward * -1f, flatLeftDir));avgVelocity = velocityBuffer.GetSmoothVal();velocityAngle = Vector3.Angle(avgVelocity, aimVelocity);velocityAngleCoef = Mathf.InverseLerp(180f, 0f, velocityAngle);flatVelocity = avgVelocity;flatVelocity.y = 0f;flatVelocityManitude = flatVelocity.magnitude;velocityCoef = Mathf.InverseLerp(0f, 15f, Vector3.Project(avgVelocity, aimVelocity).magnitude );flatVelocityAngle = Vector3.Angle(flatVelocity, flatTargetVelocity);if(!inferenceMode){if(targetDistance > nearModeRange){if(Time.fixedTime - landingMoment > landingBufferTime){bool outSpeed = flatVelocityManitude < Mathf.Lerp(0f, 7f, (Time.fixedTime - landingMoment - landingBufferTime)/4f);bool outDirection = flatVelocityAngle > Mathf.Lerp(180f, 10f, (Time.fixedTime - landingMoment - landingBufferTime)/4f);float motionLimit = Mathf.Lerp(0f, 0.5f, (Time.fixedTime - landingMoment - landingBufferTime)/4f);float motionLimit2 = Mathf.Lerp(0f, 0.7f, (Time.fixedTime - landingMoment - landingBufferTime)/4f);bool outMotion = lookAngle < motionLimit2 || upAngle < motionLimit2 || leftThighAngle < motionLimit2 || rightThighAngle < motionLimit2 || spineUpAngle < motionLimit || rootUpAngle < motionLimit || leftUpperArmAngle < motionLimit || leftForeArmAngle < motionLimit || rightUpperArmAngle < motionLimit || rightForeArmAngle < motionLimit || swordAngle < motionLimit;if( outSpeed || outDirection || outMotion){AddReward(-1f);if(outSpeed){judge.outSpeed++;}if(outDirection){judge.outDirection++;}if(outMotion){judge.outMotion++;}judge.Reset();return;}}lastReward = (velocityAngleCoef + velocityCoef) * 0.02f + (lookAngle+upAngle) * 0.0125f + (leftThighAngle+rightThighAngle) * 0.0075f+ (spineUpAngle+rootUpAngle) * 0.005f+ (leftUpperArmAngle+leftForeArmAngle+rightUpperArmAngle+rightForeArmAngle+swordAngle+tail6Angle ) * 0.001f+ (1f - exertionRatio) * 0.004f;totalReward += lastReward;AddReward( lastReward );}// else if(targetDistance > 1.5f)else{// AddReward(1f);judge.survived++;judge.Reset();return;}}}
//大致來說,
--1.獎勵視線,並使用Force Sharping
--2.獎勵投影至"跑動推薦向量"的速度和角度,並使用Force Sharping
--3.獎勵Root、Spine、雙臂、劍特定向量(forward/up/right)符合指定角度,並使用Force Sharping (這裡註記前傾指定角度為330,印象中更多容易跌倒)
--4.獎勵尾巴根部符合指定角度,但"並不使用Force Sharping"
--5.獎勵減少動作變化
實驗時間:
Step: 5e7
Time Elapsed: (忘記記錄了)
實驗結(jié)果:
實驗結(jié)果為成功
道爾會用很帥氣的跑法奔跑,讓我在刀劍神域的雛型影片可以拍得很帥氣
但一樣又要埋怨一忙碌就偷懶沒寫實驗紀錄的自己,其實這之前還有另一個跑動訓(xùn)練
而成果不盡理想,目前看起來是前一個版本劍拿很高而且很晃,然後可能大腿比較扭捏
但因為沒記錄,我也完全忘記了,所以搞不清楚到底是怎麼改善的
靠推理的話,大概是增加劍和大腿的Force Sharping
再次重申,沒寫實驗記錄的話,後悔的一定都是未來的我!
求求你了,未來可能又會忙碌的我,再忙也要記得寫實驗記錄別忘了我們還有更未來的我們,戰(zhàn)鬥的武器不是廢寢忘食
而是挑戰(zhàn)不斷進步的逐步累積啊!