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"

Get the Right Vector of a Vector?

Hi there :)!

I'm trying to implement a system in my 3D third-person project that lets my character shimmy along ledges but I've gotten stuck trying to get him to shimmy around outer (convex) corners, more specifically, when trying to get a right or left vector off of my character's forward vector to use as a trace. I've made a quick top-down sketch to show you what I'm trying to do:

Sketch

So basically, the character is hanging from the wall, facing it, and when the player moves (in this example) to the left, I want the character to move around the corner. To do this I (among other things) need to figure out where exactly the wall continues around the corner, at what angle it continues, etc. (or if there even is a wall there) so I thought I'd first use the character's forward vector to find the starting point of my line trace one capsule-width in front of the current actor location, then trace to the left (or the right, depending on the direction you're shimmying in) at a relative 90° angle. The problem, however, is that, no matter which direction the character faces, the trace always goes into the same global direction, meaning it's not relative at all. I've had a similar problem before when trying to use GetActorForwardVector and GetActorRightVector and it was solved on here in this thread: https://answers.unrealengine.com/questions/284926/forward-vector-points-in-wrong-direction.html

However, that fix doesn't seem to be working here. Here's my current set-up (it's not connected to anything because my actual blueprint is a bit messy so I copied this part out of it for the purposes of this screenshot to make it clearer which nodes are relevant to the question): Blueprint Screen 1 Blueprint Screen 2 For bigger screens, click on the attachments below. The second screen shows the GetActorForwardVectorCorrectM macro that's used in the bigger screen. If you're wondering why I have to use a custom macro for that instead of the built-in GetActorForwardVector function, it's explained in the thread I linked to above.

I've tried several different things that aren't shown here, including using both MakeRotFromY and MakeRotFromZ instead of MakeRotFromX (I have to confess that I am not entirely sure how those nodes work exactly) and using a RotateVector node with a value of 0,0,90 instead of the MakeRotFromX and GetRightVector nodes but all of those still just gave me traces going into the same global direction, no matter which direction the character was facing when they were triggered.

Here are links for both of those scripts:

https://blueprintue.com/blueprint/phumvkab/

https://blueprintue.com/blueprint/1dtz48i2/

So yeah, if you have any idea how I can get that trace to always be at a relative 90° angle to the forward vector or if you think there's a better way entirely to figure out the location and rotation of the wall around the corner (there probably is), I'd be extremely grateful to hear your thoughts :)!

Product Version: UE 4.11
Tags:
more ▼

asked Jul 06 '16 at 07:23 PM in Blueprint Scripting

avatar image

FrozenHarlequin
13 4 4 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Okay, after getting some distance from the problem and coming back to it with fresh eyes I solved it by attaching a new capsule in front of the character and getting the right vector off of that, rather than trying to use the forward vector as the starting point for the right vector, and now it works.

more ▼

answered Aug 08 '16 at 01:00 PM

avatar image

FrozenHarlequin
13 4 4 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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