Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report #455

Open
milford-sandler-0103 opened this issue Aug 28, 2023 · 0 comments
Open

Bug Report #455

milford-sandler-0103 opened this issue Aug 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@milford-sandler-0103
Copy link

Describe the bug | Bug描述
A clear and concise description of what the bug is.

void MotorComponent::calculateTargetPosition(const Vector3&& current_position)
{
Vector3 final_position;

    switch (m_controller_type)
    {
        case ControllerType::none:
            final_position = current_position + m_desired_displacement;
            break;
        case ControllerType::physics:
            final_position = m_controller->move(current_position, m_desired_displacement);
            break;
        default:
            final_position = current_position;
            break;
    }

    // Piccolo-hack: motor level simulating jump, character always above z-plane
    if (m_jump_state == JumpState::falling && final_position.z + m_desired_displacement.z <= 0.f)
    {
        final_position.z = 0.f;
        m_jump_state     = JumpState::idle;
    }

    m_is_moving       = (final_position - current_position).squaredLength() > 0.f;
    m_target_position = final_position;
}

此处position.z <= 0来判断角色是否已经落地,所以跳到别的物体上时,角色的状态一直是JumpState::falling,之后就无法再次跳跃了

Steps to reproduce | 如何复现
Steps to reproduce the behavior:

  1. 跳到场景中的立方体上
  2. 再次按空格键,无法起跳

有没有其他更好的办法判断玩家落地(或者落到其他物体上)?

@milford-sandler-0103 milford-sandler-0103 added the bug Something isn't working label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant