How I rotate my character after teleporting him on a specific surface, like a wall?

Hi,

I’m trying to prototype something to give the player the ability to teleport to the surface he is aiming, and to rotate him on this surface, to walk on.
I explain what I did : I’m firing a Single Line Trace, if I hit the specific physical material I had on my surface, I teleport on the location I aimed, and I want the player to be rotate on this surface, so he can walk on it.

Here is my blueprint made from “MyCharacter” :

Any Help ? :o

If you want to rotate your character based on a vector you can use the function “Find Look at Rotation”. You then use your character as the start parameter and the target is where you want your character to look at.

I don’t really understand the part about walking on the surface though.

Thank you for your answer :slight_smile:

Well, I’ll try to explain better :

I want my player to be teleported to a specific location, where he is aiming. When he fires the Line Trace, hes is teleported to the location he was aiming, but what I also want is my player to be able to rotate himself, so that he can have his feet on the surface he aimed.

Example : I fire on a wall => I want to be able to teleport on this wall and to walk on.

Hm, i guess you need to get some vectors of the wall to calculate how the player should be rotated.
If you want him to move on it, it could get a bit difficult.
I think somewhere in UE4 there is difined that gravity pulls you down a specific direction. You need to rewrite the “down” vector everytime you teleport to something. The new “down” vector for every gravity change is the negativ normal vector of the hitactor (wall).

BUT it could be, that this is easy to access. I don’t know if there is a BP Node or something in c++ that can easily change the direction of the gravity.

If you don’t know what the normal is or something, i would recommend you to google a bit math.
Calculating the new rotation shouldn’t be that hard. It’s something with the old player up vector and the new up vector of the wall (normal). I just woke up so i hope that is enough to give you a hint on what you have to do.

I hope i dont complicate it. Maybe someone else got an easy answer.

Help :frowning: ?

Well thank you for your answer, I will look at that :wink:
I already known about the normal vector and things like that, but I think you help me for the things related to the gravity ;).
Thanks ! I’ll check again and again until I find out and tell you !

So I’ll try something new : normalize my wall’s normal vector, make a rot from Y on this new vector, and return this rotation to make a transform, always with the same location. Here is a screenshot :

And I have something new ! Now, when I teleport my self to the wall, I’m still not walking on, but, my screen is shaking and nothing can stop him …

Help :frowning: ?

Ok first. Pls don’t spam answers. Use the comment function. Answers are solutions to your question and not a way to bump the question.

I can’t tell you what is wrong since i have no time testing it myself.
I can tell you whats on my mind.
First make sure the linetrace works fine. Than check if the model and camera are turning the way you want. Than try to change the gravity settings and check if the turning also effects the mouse axis. Maybe you have to change them.
That shaking could be the player rotated by 90° and still getting pulled into the ground by the gravity.
So first make sure the character and camera turn the right angle. Than change the gravity.