[Raycasting] Event hit doesn't work

Hi Everyone!

I would to create a gameplay like a myst-like. I use 2 blueprints: The FirstPersonCharacter and the PositionPoint.

  • The **FirstPersonCharacter **blueprint is used to perform a collision between the First Person Character and the PositionPoint Actor by raytracing.
  • The **PositionPoint **is used to calculate his position and set the First Person Character 's position with the PositionPoint’ position (It is a sphere with a blueprint).

My goal is when you press fire on the PositionPoint, you automatically go on the sphere.

The Event hit or the OnComponentHit don’t work with the raycast (LineTraceByChannel and LineTraceForObject).
In fact, when i press fire with the mouse, the PositionPoint is well hit but the Event hit is not triggered. Can you tell me why, please?

The PositionPoint collision is set on BlockAllDynamic.

You can see the PositionPoint Blueprint

And the FirstPersonCharacter Blueprint

Thank You :slight_smile:
ps: Sorry for my english!

Hello littleinfo, if all you’re trying to do is to teleport to where your positionpoint is, you can do that right after your trace, something like this.

Try using ‘Trace under cursor by channel’ node instead of ‘Line Trace by Channel’

Thank you for your answers!

@SixTwo:
Your solution works but the player can only teleport.
In my logic, it is the player who hits the objects (he interacts with the environment), and it is the scene’s actors who contain their characteristics.

For example, in the scene, there is a positionpoint and a door.
The player can hit the door or the positionpoint. It uses the raytracing to hit one of these two objects.
The objects when they are hit, trigger their events and functions.

So if the player hits the door, the door opens or closes (because it contains the blueprint for open or close).
If the player hits the positionpoint, he is teleported (because the positionpoint contains the blueprint to teleport).

If there are several possible interactions, I do not think the player’s blueprint should contain all the functions of the objects in the scene.

You see what I say? I do not know if I explain myself well :smiley:

@Orkney:
I can’t find the function. I see Get Hit Result under Cursor by Channel but i can’t use it because the node is not proposed.

Thanks.

oh okey, in that case interfaces could be what you need, follow this tutorial here LINK . If you have trouble afterwards let me know and I can try and explain a bit better.

Thanks for your answer.
I will try it tonight!! ^^

Great!! It works!!!

Thank you so much! :slight_smile: