How do I teleport player with fixed rotation?

I have several scenes where I need my actor to teleport and be turned a certain way when they get there. I’ve tried every method to make this happen but I just end up in the same direction I was in when I entered. I cannot seem to rotate my character to the correct direction no matter what I do. The screen shot is of my lever blueprint. I had previously made the destination by typing in the XYZ coordinates, but now the destination is an empty actor. As you can see, I even tried the “GetActorRotation” node and that did nothing. The teleportation is happening in the level BP. I don’t have a separate BP for the teleporter as that wouldn’t work for my use. I essentially have a character where if you touch him you teleport to one of several locations. I need each location to have its own starting rotation for when your character gets there. As of now, not a single Youtube video on teleportation contains how to do this or anything like this. Please help!

2 Likes

if i am understanding this correctly you just want the character to face a certain direction when reaching the new location. if thats the case you should look into using set control rotation. you will need a reference to the player controller to access the control rotation but it should allow you to set the cameras rotation. ive used a method such as this in a third person setup before but havent tried it in a first person one so not sure how it will work in that case.

below is a little example of what i mentioned in the previous post. what i did in the example was create a transporter actor which when overlapped checks to be sure it was a charcter that overlapped then sets the characters location and rotation, then gets the characters controller and sets the control rotation. the location and rotation in this example are gotten from a actor in the level which is referenced in this actor via a public variable of type actor. thats all to say i put a target point in the level and the character gets moved to it and if rotated the same direction as the target point. now i did this with the third person template and the rotation works like this: the set rotation will set the direction that the skeletal mesh faces. that will not however set the direction the camera faces so we use the set control rotation to set the direction the camera faces. there is no node i know of that will set bot the mesh and camera direction but its not hard to create a basic script like this.

hope that helps.

2 Likes

If by a " transporter actor" you mean a separate BP, I can’t do that. I can’t use a separate actor because I have a ghost that moves around, and if he touches you, you get teleported to one of several vision sequences. This would be done with a trigger box attached to the ghost, a begin overlap for said trigger box, and an array for the locations all in the level BP.

Screenshot? Also, bear in mind that I can’t create a separate BP for a teleporter. This all has to be done in the level BP.

you actually could do it with a separate actor but is not really the point, you can use the script here as a guide and create the logic wherever you like. making the transport into its own actor just makes it so the logic is easily reusable.

anyway for doing this in the level bp you will need to get the overlap event for the trigger box you plan to use by selecting the trigger box in the level then in the level bp search for overlap and you should see the event you need. you may also need to change the cast to be more specific so it affects only the player and not any other characters (specifically your ghost). last you will need to change where i used a actor variable as a marker, in your case just use your array and plug in some logic to a get node so you get the index from the array that you want.

Edit: below is a basic example of how it could be done using the same method but in the level bp.

Also if this type of thing is only happening when the player touches the ghost then you could just have the script in the ghost character. in this case you could use public variables to set the teleport location on a per instance basis.

1 Like

How do I get that “Equals” attached to the trigger box? Says it’s incompatible.

I think I pulled it off. It seems to be working now. This is my script.

the equal node should be a actor = actor, but the easiest way to get it would be to drag off of the other actor pin then type in a equal sign. you will want to include the part with the equal to prevent the overlap happening when the trigger box overlaps other things.

as long as its working thats the important bit.

Would that still happen even though the target is my player? I mean it shouldn’t teleport anything else.

your right only the player can be teleported, but what initiates the teleport could be anything unless specified.

you say you want to attach the trigger box to your ghost right. well in that case the trigger is overlapping the ghost. then the ghost will be moving around so the trigger could overlap many other objects too (walls, other enemies, etc). every time the trigger box overlapped something the player would get teleported. if you specified that you only want the script to run if the other actor is equal to the player however things will work as intended. the script up to and including the branch is like asking did i overlap the player, if yes (true) proceed wit hthe script and teleport, if no (false) do nothing.

bottom line without flow control you could be in a constant state of teleport when you begin playing.