Hi, i have a line trace that returns a hit. I need to get the location of the hit component in world space. I am sure there must be a way to do this, can someone help me?
If there is no way to do this, how could i modify this function to return the same thing (it aplies the transform of the mesh to the bounding box of the mesh, projects the box on the XY plane and returns the corners of the formed square ) ?
TArray<FVector> CustomMath::GetWorldBoundingBoxPoints(UStaticMeshComponent* Mesh)
{
TArray<FVector> Points;
Points.Init(FVector::ZeroVector, 4);
Mesh->GetLocalBounds(Points[0], Points[2]);
Points[1].X = Points[2].X;
Points[1].Y = Points[0].Y;
Points[3].X = Points[0].X;
Points[3].Y = Points[2].Y;
FVector Loc = Mesh->GetComponentLocation();
float RotYaw = Mesh->GetComponentRotation().Yaw;
for (FVector Point : Points)
{
Point.RotateAngleAxis(RotYaw, FVector(0.0f, 0.0f, 1.0f));
Point += Loc;
Point.Z = 0.0f; //i don't need Z
}
return Points;
}