Announcement

Collapse
No announcement yet.

Turret Fire's in Opposite direction instead of targeting the player?

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

    Turret Fire's in Opposite direction instead of targeting the player?

    I have everything set up and everything compiled correctly, But when i play, my Turret rotates 180' degrees around and starts shooting in the other direction.

    Here is a screenshot of my setup to see if anyone can spot my mistake.


    Click image for larger version

Name:	TurretAiming.JPG
Views:	1
Size:	108.0 KB
ID:	1175200

    #2
    Ok, so Pitch is rotation around the y axis, which would be up and down, like shaking your head yes. Yaw is rotation around the z axis, which is side to side, or shaking your head no. Roll is rotation around the x axis, which would be like touching your ear to your shoulder.

    Comment


      #3
      Here are some more screenshots to help...

      Click image for larger version

Name:	Capture3.JPG
Views:	2
Size:	35.0 KB
ID:	1101503


      The sphere represents the turret and the box is the target


      And plus i keep getting this Warning Error..

      Click image for larger version

Name:	ErrorMessage.JPG
Views:	1
Size:	77.0 KB
ID:	1101504

      Comment


        #4
        Ehm yeah, the "PlayerPawn" node you are using is returning a Pointer. If you access pointers while they are null, you will get that error.
        And yes, this is nothing to be accepted, but needs to be fixed. Because without a valid reference to the Pawn, you can't get information from it, like the Location
        you are trying to get.

        First of all, use "IsValid" nodes on your Pointers(References), and only proceed with getting something from them, if the VALID exec is called.
        Second, do you actually have a possessed pawn? So do you have some kind of pawn spawned and possessed by the PlayerController?
        Do you have a default pawn in the GameMode?
        Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

        My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
        (Including 100+ Pages Multiplayer Network Compendium to get you started.)

        Comment


          #5
          Well there isn't a PlayerController actually. it's just the Cube that i need to target. the Cube was just a regular actor but i couldn't get the location for it,
          except in the level BluePrint so i made it into a Pawn Blueprint to get the location in my Turret Blueprint.

          So would i need to use IsVaild on all the references or just in the beginning on the GetPlayerPawn node?

          Comment


            #6
            I was actually just making a turret myself and ran into a similar issue and I STRONGLY doubt that it'll help but I'll throw it out there anyway.

            In my case I took my root and rotated it in the blueprint as I had my turret mesh facing the wrong way on accident.. This actually created a ton of problems that didn't even occur to me until the next day (was about to fall asleep and then was like AHA!). Unrotated it and fixed it and everything works fine now. Not sure if that'll help but it's a thing.

            Also you CAN skip the break -> make rotators step by simply right clicking the blue rotator input/output node and selecting "split" or something like that and you'll get the same thing.

            Comment


              #7
              Originally posted by Corrupt_Override View Post
              Well there isn't a PlayerController actually. it's just the Cube that i need to target. the Cube was just a regular actor but i couldn't get the location for it,
              except in the level BluePrint so i made it into a Pawn Blueprint to get the location in my Turret Blueprint.

              So would i need to use IsVaild on all the references or just in the beginning on the GetPlayerPawn node?
              IsValid is generally a good idea on references if you aren't 100% sure that they are valid.
              Outside of the PIE, your game will simply crash if you happen to get one of the accessed none errors.

              If you need references in your Turret of the Actor, use overlaps. If that is already too much, you might want to check out the following
              stream about BP communication:
              Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

              My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
              (Including 100+ Pages Multiplayer Network Compendium to get you started.)

              Comment

              Working...
              X