[C++]I need help with a building system

So iam trying to make something spawn on my mouse location in a 3d world space. but it seems that the coordinates are totaly wrong ! Iam not getting an error or something.

APlayerController* cont = GetWorld()->GetFirstPlayerController();
	if (cont)
	{
		FVector start;
		FRotator camrot;
		GetActorEyesViewPoint(start, camrot);
		FVector2D mousePos;
		cont->GetMousePosition(mousePos.X,mousePos.Y);//here i get the 2d mouse position
		FVector mouseinWorldSpace = FVector(mousePos.X,mousePos.Y,0);
		FVector dir;
		cont->DeprojectMousePositionToWorld(mouseinWorldSpace,dir);//and here the 3d mouse position
		FVector end = mouseinWorldSpace;
		end.Z -= 1000;
		FHitResult hit;
		FCollisionQueryParams params;
		params.AddIgnoredActor(this);
		if (Raycast(start, end, hit, params))//then i shoot a simple linetrace to the 3d mouse position
		{
			UWorld* world = GetWorld();
			if (world)
			{
				DrawDebugLine(world, start, hit.Location, FColor(255, 0, 0), true, 100, 0, 12);//and then i want to spawn this line where my mouse pos is but it dosent work
			}
		}
	}

I hope someone can help me,
Gunschlinger

I’m not really a C++ guy but I noticed you’re using the GetActorEyesViewPoint from the current context instead of the player controller. Perhaps this is giving you bad values.

thanks for the awnser but this didnt helped me