Announcement

Collapse
No announcement yet.

Target Lock-on via Key Press

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

    Target Lock-on via Key Press

    Hi everyone,

    So I have been working on a mechanic where I have a spectator camera pawn lock-on to a character pawn. The aim is for my spectator camera pawn to rotate toward the character pawn's position in the world at all times when I press the F key. The problem I am having is, for some reason when I set the target to lock-on as self (the spectator camera pawn) it works perfectly! But unfortunately when I set the target to be the character pawn it does not even perform the lock-on action. I have been stuck for some time, any help would be appreciated.

    The first image depicts the key press functionality which calls a custom event which in turn calls a function over a network.
    Click image for larger version

Name:	TargetLockOn_3.jpg
Views:	1
Size:	414.9 KB
ID:	1167098


    Within the function which contains the lock-on code
    Click image for larger version

Name:	TargetLockOn_4.jpg
Views:	1
Size:	587.1 KB
ID:	1167099

    #2
    Why is there a cast but no actual object in the frameCharacter function? You're getting actor location, but which actor are you getting? and you should get Player Pawn actor location instead of Player Controller actor location surely?
    Omar Albadry - GameSparks
    Main Website http://www.gamesparks.com/ Docs/Learn website https://docs2.gamesparks.com/

    Comment


      #3
      Hi! Yes I fixed that and now the spectator pawn looks toward the character pawn when he spawns, but only once. The spectator pawn for some reason does not rotate toward the character's position even though I have set a find look at rotation within a tick event.

      This is how the blueprint function looks now
      Click image for larger version

Name:	TargetLockOn_5.jpg
Views:	2
Size:	456.6 KB
ID:	1093509
      Attached Files
      Last edited by Godstepson; 11-18-2015, 01:23 PM.

      Comment


        #4
        bottom left corner of this picture you'll see you have not execution going through that Cast to DirCamSnapTestActor....it's not being called....you need to run an execution line through it likely from your SwitchHasAuthority to the Cast then to SetControlRotation....

        Streams: www.Twitch.tv/BlinkTheory
        Patreon: www.Patreon.com/BlinkTheory

        Comment


          #5
          Hello,

          It seems that still did not do the trick. After fiddling for a while I believe I narrowed down the problem but still with no solution (take a look at the red highlights from the image below). Inserting any vector node (whether custom or from location vectors of spawned actors in-game) within the Target from the Find Look at Rotation did not make any changes to the rotation of my pawn's spectator camera. What I am trying to achieve with the Find Look at Rotation is obtain the location (from the client) of a pawn that is controlled by different player controller over a listen server. In simpler terms, how do I get/reference/obtain the location of the listen server's player controlled pawn when I am on a puny client?

          Click image for larger version

Name:	TargetLockOn_5.jpg
Views:	1
Size:	515.8 KB
ID:	1093529
          Attached Files

          Comment


            #6
            I don't have much time to experiment unfortunately because I am at work but in theory this should work. Have a Run on Server event which gets a random or preset or closest Pawn or whatever class the controlled actors are and set that as a replicated variable. Use that variable in your LookAt function, hope that works for you! If not, then let me know and I'll try find you a solution.
            Attached Files
            Omar Albadry - GameSparks
            Main Website http://www.gamesparks.com/ Docs/Learn website https://docs2.gamesparks.com/

            Comment


              #7
              Hi, sorry for the delayed response I have been away from home for these past few days. I will definitely try what you said and post my update. Thank you for taking the time out of your busy schedule to help me, I greatly appreciate it!

              Comment


                #8
                Hi Monument2Sin,

                Thanks a lot it worked great! Here are screen shots in case anyone is interested in replicating what I did for a simple target lock-on mechanic via network!
                Click image for larger version

Name:	CharacterBlueprint_TargetLockOnMain.JPG
Views:	1
Size:	114.0 KB
ID:	1093956
                Click image for larger version

Name:	TargetLockOnFunction.JPG
Views:	1
Size:	108.3 KB
ID:	1093957

                Comment


                  #9
                  HI, can you please help? I don't understand some things in the screenshots.

                  Comment

                  Working...
                  X