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.
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.
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.
Here are some more screenshots to help…
The sphere represents the turret and the box is the target
And plus i keep getting this Warning Error…
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?
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?
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.
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:
https://youtube.com/watch?v=EM_HYqQdToE