When I use the function
UGameplayStatics::SpawnDecalAttached(bulletHoleDecal, FVector(5, 5, 5), object, NAME_None, hit.Location, hit.Normal.Rotation(), EAttachLocation::KeepRelativeOffset, 20);
Nothing happens, but when I just use SpawnDecalAtLocation it works fine.
I can’t get many of the functions in C++ to work like AddForce for instance.
Please help… What am I doing wrong?
Here is the whole thing. I’m trying to spawn an attached decal at the hitresult location.
FHitResult hit;
FVector startPosition = FirstPersonCameraComponent->GetComponentTransform().GetLocation();
FVector direction = FirstPersonCameraComponent->GetForwardVector();
const FName traceTag("fireLine");
World->DebugDrawTraceTag = traceTag;
FCollisionQueryParams params;
params.AddIgnoredActor(this);
params.TraceTag = traceTag;
World->LineTraceSingleByChannel(hit, startPosition, startPosition + direction * 100000, ECC_WorldDynamic, params);
if (hit.GetComponent() != NULL)
{
UPrimitiveComponent * object = hit.GetComponent();
UGameplayStatics::SpawnDecalAtLocation(hit.GetActor(), bulletHoleDecal, FVector(5, 5, 5), hit.Location, hit.Normal.Rotation(), 20);
if (object->IsSimulatingPhysics())
{
object->AddForce(FVector(0, 0, 1000));
}
}