Download

RayCast not get anything

Hi all~
I do a ray cast in BeginPlay Event of my playercontroller, but get nothing. In any binding event ex keydown, I can get a hit result correctly. The thing is I want to know what event is good to do a ray cast except keyboard or mouse event . I would like automatically get hit result to place my other objects.

Thanks

You can do raytraces anywhere (even in the editor when the game is not running).

Might be worth checking that your raytrace actor is indeed in the location you want it to be. Try using DrawDebugLine to show an actual line of the trace for a few seconds, this way you can see if your trace is actually in the right spot! :slight_smile:

What are you trying to raycast against (terrain, an object)?

Have you verified the object is actually spawned in at the time your Player’s BeginPlay is called?

There’s various delegates you can hook into: https://api.unrealengine.com/INT/API/Runtime/Engine/Engine/FWorldDelegates/index.html

I wait for the time when all static meshes have loaded. I think I need to know how to use FWorldDelegate…

Thanks