Raycasting in UE4.

Hi, i’m planning on making a game in which you will rotate different mirror objects to bounce lasers fired from static objects in the level in order to get the laser to hit a certain point in the level.
I have been looking around the documentation but i cant seem to find some sort of raycasting function that i could use to determine the pathing that lasers would take.
Do anyone know of some sort of raycasting function or have another way for me to do something like this?

Thanks.
//

Does this help?

http://img835.imageshack.us/img835/1677/5aki.png

It’s from the source, PxScene.h, line 1289 . I think Px files are all related to Physics, so all physic functions that relate to the entire scene are found in PxScene (Including some rigidbody stuff I think). Actor related physics are probably found in the collider then.

Hi ,
While it’s true that you can use PhysX directly, this approach is not recommended. We wrap all the PhysX functionality in our own functions which you should use instead.
Take a look inside WorldCollision.cpp where you’ll find UWorld::SweepSingle and many other scene query function. It’s likely that you want to use the functions found in this file.
As a side note, all of our queries to PhysX will funnel through PhysXCollision.cpp so if you find a function in there you can see where it’s coming from and how it’s used. Hope that helps!

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Engine/UWorld/LineTraceSingle/1/index.html

Looks a little like this. Though this is for a single cast.
FHitResult testHitResult;
UWorld* TheWorld = this->GetWorld();
FVector testStartFVector = this->GetActorLocation();
FVector testEndFVector = testStartFVector + GetActorForwardVector() * 100;

FCollisionQueryParams TraceParams(TEXT("TraceOfAwesome"));




if (TheWorld->LineTraceSingle(testHitResult, testStartFVector, testEndFVector, ECC_WorldStatic, TraceParams))
{
	UE_LOG(LogClass, Log, TEXT("Im Hitting Something"));

}
else
{
	UE_LOG(LogClass, Log, TEXT("Not Hitting anything"));
}

Alright, thanks for the replies.
Helped alot :smiley: