当我尝试跳近一个框(并向框方向移动)时,角色卡住了。一些线索可能会发生什么以及如何解决?
情况:
当角色控制器Collider星减小半径时,角色似乎卡住了。
NavMesh信息: NavMesh information 2 [ 2
字符控制器:
我希望角色能够到达方块的顶部,或者至少他能够爬出这么小的差异
跳转代码:
public void jump()
{
if (OnSlope())
{
print("controller.height: " + controller.height);
controller.Move(Vector3.down * controller.height / 2 * slopeForce * Time.deltaTime);
}
print("key press jump");
JumpMode = true;
StartCoroutine(JumpEvent());
}
private IEnumerator JumpEvent()
{
controller.slopeLimit = 90.0f;
float timeInAir = 0.0f;
//print("IEnumerator JumpEvent");
float timePassed = 0;
while (timePassed < 1.5F)
{
float jumpForce = jumpFallOff.Evaluate(timeInAir);
controller.Move(Vector3.up * jumpForce * jumpMultiplier * Time.deltaTime);
timeInAir += Time.deltaTime;
// Code to go left here
timePassed += Time.deltaTime;
yield return null;
}
/*
do
{
float jumpForce = jumpFallOff.Evaluate(timeInAir);
controller.Move(Vector3.up * jumpForce * jumpMultiplier * Time.deltaTime);
timeInAir += Time.deltaTime;
//print("INTOWHILE JumpEvent");
//print("inside- controller.isGrounded: " + controller.isGrounded);
//print("inside-(controller.collisionFlags & CollisionFlags.Below) == 0): " + ((controller.collisionFlags & CollisionFlags.Below) == 0));//.ToString()
//print("inside-((controller.collisionFlags & CollisionFlags.Above) == 0) " + ((controller.collisionFlags & CollisionFlags.Above) == 0));
yield return null;
}
while (!controller.isGrounded);// && controller.collisionFlags != CollisionFlags.Below);// .Above); ((controller.collisionFlags & CollisionFlags.Below) == 0) && ((controller.collisionFlags & CollisionFlags.Above) == 0));//
*/
//print("outside- controller.isGrounded: " + controller.isGrounded);
//print("outside- (controller.collisionFlags & CollisionFlags.Below) == 0): " + ((controller.collisionFlags & CollisionFlags.Below) == 0));//.ToString()
//print("outside- ((controller.collisionFlags & CollisionFlags.Above) == 0) " + ((controller.collisionFlags & CollisionFlags.Above) == 0));
controller.slopeLimit = 45.0f;
JumpMode = false;
}