# Line Trace sometimes misses landscape

**URL:** <https://forums.unrealengine.com/t/line-trace-sometimes-misses-landscape/316778>\
**Category:** World Creation\
**Tags:** line-trace, physx, unreal-engine, Blueprint, question\
**Created:** [April 29, 2015, 12:12am UTC](https://forums.unrealengine.com/t/line-trace-sometimes-misses-landscape/316778 "2015-04-29T00:12:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slayemin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slayemin](https://forums.unrealengine.com/u/Slayemin)\
**Post date:** [April 29, 2015, 12:12am UTC](https://forums.unrealengine.com/t/line-trace-sometimes-misses-landscape/316778/1 "2015-04-29T00:12:55Z")

</div>

**Engine Version:** 4.7.4

I am trying to figure out the height of the landscape at any given point and I use the line trace method for that. Unfortunately, it misses the landscape completely on some occasions.

I use these vector endpoint values to intersect with the landscape:

**Start:** -60.171597, 6648.526367, 1100.839844

**End:** -60.171597, 6648.526367, -899.160217  
The landscape Altitude / Z value is 0 at this position.

I can repeatably miss the landscape on my level map by using these values in blueprints (Line Trace by Channel).

Just for fun, I tried the same values in C++ with the following code:  
FHitResult hr;

```
	UWorld* World = GetWorld();
	if (World)
	{
		
		World->LineTraceSingle(hr, FVector(-60.171597f, 6648.526367f, 1100.839844f), FVector(-60.171597f, 6648.526367f, -899.160217f), FCollisionQueryParams(), FCollisionObjectQueryParams(ECollisionChannel::ECC_Visibility));
	}

```

**That also misses the terrain.** I try to dig into the engine source, but the trace code uses PhysX code and that’s a bit beyond me. (\Engine\Source\Runtime\Engine\Private\Collision\PhysXCollision.cpp, **Line 833** )

I can upload the level if it helps to reproduce this issue.

My current work-around is to use a sphere trace which gives correct results.

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [April 29, 2015, 3:28am UTC](https://forums.unrealengine.com/t/line-trace-sometimes-misses-landscape/316778/2 "2015-04-29T03:28:26Z")

</div>

I had the same problem here: [Single Line Trace does not always hit the Object (Landscape) - World Creation - Epic Developer Community Forums](https://answers.unrealengine.com/questions/133871/single-line-trace-does-not-always-hit-the-object-l.html)

Answer from Epic:

> I was able to reproduce this and have entered a bug report, UE-11871 to be assessed by the development staff.
