Announcement

Collapse
No announcement yet.

[Raycasting] Event hit doesn't work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [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
    Click image for larger version

Name:	PositionPoint_BP.png
Views:	1
Size:	191.5 KB
ID:	1167817

    And the FirstPersonCharacter Blueprint
    Click image for larger version

Name:	FPC_BP.png
Views:	1
Size:	176.9 KB
ID:	1167818

    Thank You
    ps: Sorry for my english!
    Last edited by littleInfo; 12-03-2015, 04:18 AM. Reason: More details added

    #2
    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.

    Click image for larger version

Name:	c7ae3f02b766454621c9557fc0482a6e.png
Views:	1
Size:	307.6 KB
ID:	1094432

    Comment


      #3
      Try using 'Trace under cursor by channel' node instead of 'Line Trace by Channel'
      My Game Frontier Devblog HERE

      Comment


        #4
        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

        @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.

        Comment


          #5
          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.

          Comment


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

            Comment


              #7
              Great!! It works!!!

              Thank you so much!

              Comment

              Working...
              X