新人继续求助。
我创建了三个BindAction的按键。InputComponent->BindAction("DunForWard", IE_Pressed, this, &AOneCharacter::DunForWard);
InputComponent->BindAction("DunRight", IE_Pressed, this, &AOneCharacter::DunRight);
InputComponent->BindAction("DunLeft", IE_Pressed, this, &AOneCharacter::DunLeft);
然后是用播放蒙太奇来实现动画的
//Play DunForWard Montage
void AOneCharacter::DunForWard()
{
if (DunForWardMontage != NULL)
{
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if (AnimInstance != NULL)
{
AnimInstance->Montage_Play(DunForWardMontage, 1.0f);
}
}
}
//Play DunRight Montage
void AOneCharacter::DunRight()
{
if (DunRightMontage != NULL)
{
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if (AnimInstance != NULL)
{
AnimInstance->Montage_Play(DunRightMontage, 1.0f);
}
}
}
//Play DunLeft Montage
void AOneCharacter::DunLeft()
{
if (DunLeftMontage != NULL)
{
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if (AnimInstance != NULL)
{
AnimInstance->Montage_Play(DunRightMontage, 1.0f);
}
}
}
可是,播放的时候我发现蒙太奇视频有点长。停止按键之后,人物不会立马就停止动作
我试过使用IE_Releasrd,可是,我不知道要如何判断按键为假。
请问怎么样才能让它一停止按键,就会停止播放蒙太奇呢?
还有。请问如何才能用C++自定义一个按键和按键组合呢?
本帖最后由 mknmknmk 于 2017-11-30 09:47 编辑
bind release 没有写
有方法 Montage_Stop
Montage_Pause
Montage_Resume
Montage_JumpToSection
Montage_SetPlayRate
Montage_SetPosition
InputComponent->GetAxisKeyValue
PlayerController->IsInputKeyDown(EKeys::A)
mknmknmk 发表于 2017-11-30 09:42
bind release 没有写
有方法 Montage_Stop
我试了一下,发现不行,Montage_Stop的第一个参数是多少秒之后停止吗?。
void AOneCharacter::StopDunLeft()
{
if (DunLeftMontage != NULL)
{
UAnimInstance* AnimInstance = Mesh1P->GetAnimInstance();
if (AnimInstance != NULL)
{
AnimInstance->Montage_Stop(0.1f, DunLeftMontage);
}
}
}
页:
[1]