I am doing a ledge grab exactly like in crysis 3 where when in air it will perform a raycast an if there is a ledge grab entity or a spline in my case it will say something for now. Right now here is my source.
FHitResult Hit;
FVector Start, End;
float Radius = 100;
Start = GetActorLocation() + FVector(0, 0, 50);
End = Start + (GetActorRotation().Vector() * 100);
FCollisionQueryParams Params(TEXT("Trace"), false, this);
FCollisionObjectQueryParams ObjectParams;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("This is an on screen message!"));
if (GetWorld()->LineTraceSingle(Hit, Start, End, Params, ObjectParams))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::White, TEXT("This is an on screen message!"));
}
this is in my on start jump function. What it does right now is everytime it hit space bar it does a trace but thtas not what i want i want it to perform a trace while in the air. I tried a while loop in my tick function and tried it such that if bPressedJump is true it will perform the trace and so on but when i try that it crashes. Some help please?