properly using set actor location and rotatiom

I have a simple teleport setup for the player.
as soon as you walk into a certain trigger box u teleport. .
I have, “on actor begin overlap” from the trigger box fed into…
“Set actor location and rotation”. So he teleports and faces whatever direction I need.
I have a target on the map and refernce the location with that…
but how do I change the rotation of the player?? Whay node am I looking for to change it on just the z axis?

Thank you.

It depends. If you just want him to face a specific direction, try using the Set Actor Rotation, Make Rot, or Break Rot node.

If you want him facing something in the teleport zone, you might try Find Look at Rotation. There are probably some other ways to get an actor and set your rotation based on where that actor is in relation to you.

Awesome. Ill look into it. Thank you.

I’m confused…I simply can set the coordinates of the rotation inside the set actor location and rotation node. But when i change Z nothing happens to the pawn. And when I change X or Y it sends me down into the ground…any idea what im doing here?

If you are modifying Rotation via X/Y/Z, that corresponds to Roll/Pitch/Yaw. It is easier to drag off of the Rotation pin and select Make Rot to be able to see Roll, Pitch, and Yaw:

6523-rotations.png

For most purposes of having a character face a particular location, you will want to only rotate the character’s Yaw, which you can isolate from a Find Look at Rotation like this:

Hope that explains a little more for you.

-Steve

Yes that makes sense now. I will try this. :slight_smile: thanks

Start should be the vector of your player’s spawn location. Target should be a reference point somewhere away from the player(what you want him to look at for instance).

What exactly is the difference between the two inputs on the Look Find At Location Node? I think that may be why I can’t get it to work…I’m not really sure what they mean…

How exactly do I pull the vector of the player in a level blueprint??

Use Get Actor Location (just start typing it and you will get the node) to get the vector that gives you the actor’s current location. However isicne you want the location of the spawn location (ie where he is being teleported), you can plug that vector into it. I assume you already know where the player should be after the teleport.

For target, if you have a particular actor the player should target, get a reference to him and pull a similar node (get actor location) from it and plug it to target.

I can’t get that node. “get actor location”. I have nothing to reference accept for self. The player is a BP. So the Get Actor thing will not work. I’ve tried that a couple times…and I’m not sure how plugging the spawn location into the start would work. I spawn there yes but thats not working either. If I use where I’m spawning as the start and then a target in the other direction as the target, still nothing happens…

Its a super simple setup. On Actor Begin overlap (triggerbox1) to Set Actor Rotation and Location. I target Get Player Pawn with index 0 of course. and the location I’ve created a target and promoted its location to a variable and set it as the location. So the teleport works. All thats left is the rotation…and I’ve tried all of these things…I don’t know why it isn’t working,

Does anyone have an idea of what I could possibly be doing wrong?.

After playing with it more I can honestly say Im getting a little further…but not there.
So heres the question revised now.
How can I set the location of the players class bp with a find look to location???

Try setting a variable with your character BP so you can continue to reference and use in the SetActorLocation&Rotation node.

Alternatively, put that SetActorLocation&Rotation in your Character BP that is called by an event such as “Teleported” or “Teleported to X Location”.

You can work out the details later, but getting it to work the first time should ensure you are on the right track.

I’m not sure…there has to be something I’m doing wrong because none of these things change my rotation unless they just send me in the floor…t’s like the rotation only changes my location…and incorrectly…
thanks for your help though.

Look at Rotation will only give you the rotation need for your character to turn and look at the spot. It will not actually move his location. If you’re looking at the spot using LookAtRotation you should already have the location listed somewhere. So just set your characters location to that. Problem is if you do both at the same time. Your charaacter is going to warp there and then look in a funny direction because you are now standing on the location - instead store the rotation from LookAtRotation, then warp there, then immidiately converting the stored look at rotation back to a vector and multiplying like 500 against it, then add it to the location you warped at, then get lookatRotation once more to the new location you created which should be 500 units out in front.

I was having this same problem in a FPS template and discovered that you need to set the rotation using a Set Control Rotation node and with the Player Controller (Get Player Controller) as the target.

1 Like