
Thank you so much.
//Just move 0.01 in random direction, you really just want a point test (overlap) though. //Make smaller than 0.01 if required for accuracy or game scale. FVector Distance = 0.01; FVector Dir = FMath::VRand(); FVector Start = BoxLocationWithOffset; //renamed for clarity of calculating End FVector End = Start + Dir * Distance;
/** Structure containing information about one hit of an overlap test */ USTRUCT() struct ENGINE_API FOverlapResult { GENERATED_USTRUCT_BODY() /** Actor that the check hit. */ UPROPERTY() TWeakObjectPtr<class AActor> Actor; /** PrimitiveComponent that the check hit. */ UPROPERTY() TWeakObjectPtr<class UPrimitiveComponent> Component; /** This is the index of the overlapping item. For DestructibleComponents, this is the ChunkInfo index. For SkeletalMeshComponents this is the Body index or INDEX_NONE for single body */ int32 ItemIndex; /** Utility to return the Actor that owns the Component that was hit */ AActor* GetActor() const; /** Utility to return the Component that was hit */ UPrimitiveComponent* GetComponent() const; /** Indicates if this hit was requesting a block - if false, was requesting a touch instead */ UPROPERTY() uint32 bBlockingHit:1; FOverlapResult() { FMemory::Memzero(this, sizeof(FOverlapResult)); } };
FVector FloorBoxSize = GetWantedBoxSize(); // .. FVector BoxLocationWithOffset = GetActorLocation(); BoxLocationWithOffset.Z -= BoxSize.Z; // Puts the box at desierd height. FVecotr End = ?; // Help is needed here. ... // How can i use this as i do OverlapMulti ? GetWorld()->SweepMulti(CurrentOverlapsHits, BoxLocationWithOffset, End/* ? */, FQuat::Identity, FCollisionShape::MakeBox(FloorBoxSize), Params, ObjParams); // Gets the data needed but can`t get it at wanted location and size.. // This was very simple way is it not the same this SweepMulti() ? GetWorld()->OverlapMulti(CurrentOverlaps, BoxLocationWithOffset, FQuat::Identity, ECollisionChannel::ECC_GameTraceChannel3, FCollisionShape::MakeBox(FloorBoxSize), Params); // Right where i need it to be but don`t return the needed data.
Leave a comment: