本帖最后由 cow1330 于 2019-4-5 12:07 编辑
小弟在試用FVector進行空中的判定,想說如果射線沒與地面接觸就當是空中
目前以經把射線改成人物的腳上,但對地面有無反應不知
用 FCollisionQueryParams CollisionParams; 查也沒反應,但只對自已碰撞有反應
void ACharacterBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FHitResult OutHit;
FVector Start = GetActorLocation();
Start.Z += -135.f;
FVector Forward = GetActorUpVector();
FVector End = ((Forward * 10.f) + Start);
FCollisionQueryParams CollisionParams;
DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 0, 0, 5);
if (ActorLineTraceSingle(OutHit, Start, End, ECC_WorldStatic, CollisionParams))
{
GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Green, FString:rintf(TEXT("The Component Being Hit is: %s"), *OutHit.GetComponent()->GetName()));
}
}
|