x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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" : alt text

Any Help ? :o

Product Version: Not Selected
Tags:
more ▼

asked Aug 09 '14 at 12:25 PM in Blueprint Scripting

avatar image

Dusaral
85 3 4 10

(comments are locked)
10|2000 characters needed characters left

6 answers: sort voted first

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.

more ▼

answered Aug 09 '14 at 01:23 PM

avatar image

Fauzruk
48 7 9 11

(comments are locked)
10|2000 characters needed characters left

Thank you for your answer :)

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.

more ▼

answered Aug 09 '14 at 01:39 PM

avatar image

Dusaral
85 3 4 10

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Aug 10 '14 at 10:48 AM

avatar image

eXi
6.7k 330 183 464

(comments are locked)
10|2000 characters needed characters left

Help :( ?

more ▼

answered Aug 10 '14 at 10:12 AM

avatar image

Dusaral
85 3 4 10

(comments are locked)
10|2000 characters needed characters left

Well thank you for your answer, I will look at that ;) 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 !

more ▼

answered Aug 10 '14 at 11:36 AM

avatar image

Dusaral
85 3 4 10

(comments are locked)
10|2000 characters needed characters left

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 :

alt text

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 :( ?

more ▼

answered Aug 10 '14 at 12:17 PM

avatar image

Dusaral
85 3 4 10

avatar image eXi Aug 10 '14 at 11:57 PM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question