/** * 1.人物正前方做CapsuleCast(capsuleBottom向上微抬) * 2.hit点向上抬 探出碰撞体高 + 人物高 的距离 * 3.向下做SphereCast(半径0.3),目的是人物所站位置与攀爬位置有一定的容错 * 4.hit点作为攀爬点,做MatchTarget(手到hit点差值) * 5.人物站立位置往正前方移动1m,做OverlapCapsule,检测翻越 */ private void TestTrigger(PlayerEntity player) { if (null == player) { return; } if (null != _concretenessAction && _concretenessAction.PlayingAnimation || !ClimbUpCollisionTest.ClimbUpFrontDistanceTest(player)) { ResetConcretenessAction(); return; } Logger.Info("[Tmp]Interrupt"); player.stateInterface.State.InterruptAction(); if (player.hasFirstPersonModel) { _p1Position = player.firstPersonModel.Value.transform.localPosition; } GenericActionKind kind; float yTranslateOffset; float yRotationOffset; ClimbUpCollisionTest.ClimbUpTypeTest(player, out kind, out yTranslateOffset, out yRotationOffset); CreateConcretenessAction(kind, yTranslateOffset, yRotationOffset); }
/** * 1.人物正前方做CapsuleCast(capsuleBottom向上微抬) * 2.hit点向上抬 探出碰撞体高 + 人物高 的距离 * 3.向下做SphereCast(半径0.3),目的是人物所站位置与攀爬位置有一定的容错 * 4.hit点作为攀爬点,做MatchTarget(手到hit点差值) * 5.人物站立位置往正前方移动1m,做OverlapCapsule,检测翻越 */ private void TestTrigger(PlayerEntity player) { if (null == player) { return; } if (null != _concretenessAction && _concretenessAction.PlayingAnimation || !ClimbUpCollisionTest.ClimbUpFrontDistanceTest(player)) { ResetConcretenessAction(); return; } GenericActionKind kind; Vector3 matchTarget; ClimbUpCollisionTest.ClimbUpTypeTest(player, out kind, out matchTarget); CreateConcretenessAction(kind, matchTarget); }
/** * 1.人物正前方做CapsuleCast(capsuleBottom向上微抬) * 2.hit点向上抬 探出碰撞体高 + 人物高 的距离 * 3.向下做SphereCast(半径0.3),目的是人物所站位置与攀爬位置有一定的容错 * 4.hit点作为攀爬点,做MatchTarget(手到hit点差值) * 5.人物站立位置往正前方移动1m,做OverlapCapsule,检测翻越 */ private void TestTrigger(PlayerEntity player) { if (null == player) { return; } if (null != _concretenessAction && _concretenessAction.PlayingAnimation || !ClimbUpCollisionTest.ClimbUpFrontDistanceTest(player)) { ResetConcretenessAction(); return; } GenericActionKind kind; float yTranslateOffset; float yRotationOffset; ClimbUpCollisionTest.ClimbUpTypeTest(player, out kind, out yTranslateOffset, out yRotationOffset); CreateConcretenessAction(kind, yTranslateOffset, yRotationOffset); }