Announcement

Collapse
No announcement yet.

How to find out what the player camera is directly looking at?

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

    How to find out what the player camera is directly looking at?

    I've just downloaded UE4 and have been messing around with the blueprint system, and I have been unable to find a way to find out what object is directly in front of the camera? (For things such as interacting with switches and such)
    I am aware that there are volumes and such which I could use for a similar effect, but I would like to use something similar to 'raycasts' from the Unity engine, in which it sends out a 'line' from a vector, in a direction to another vector, and returns the first object it hit's if any.
    I have tried to use the 'Single Line Trace for Objects' but I am unable to either: get the position of the player camera, or I am unable to use "Line Traces' as a method for this? I am unsure as to which is wrong :/
    Any help would be appreciated

    #2
    I think the camera forward vector = controller forward vector, you can see an example of it in the character blueprint in third person game project



    so then you can rotate your trace start position by it

    please know I'm not fully sure.
    Last edited by VFXM; 03-22-2014, 12:52 PM.

    Comment


      #3
      Originally posted by VFXM View Post
      I think the camera forward vector = controller forward vector, you can see an example of it in the character blueprint in third person game project



      so then you can rotate your trace start position by it

      please know I'm not fully sure.
      Thankyou for answering, but no, I believe that the 'Control Rotation' refers to the capsule that makes up the whole collision model

      Comment


        #4
        No problem, for me i used it to get the cross product with pawn forward vector and it works

        Comment


          #5
          This should be the correct solution

          Comment


            #6
            Thankyou

            Comment


              #7
              Ok, here is my set up for the input, but it's not working? It almost seems like the input isn't firing? -

              Comment


                #8
                * http://imgur.com/DP7XZ04

                Comment

                Working...
                X