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 to get (x,y,z) values from a location or transform in C++

I know how to retrieve the x,y and z values from a vector in blueprints (you just break the vector into it's multiple parts) but how do you accomplish this in C++? For example, I want to get the x-axis value of my game character in world space so I can get as far as:

 GetTransform()->GetLocation()

which returns a FVector. But as far as I can tell I don't see how to break this vector up and grab an individual axis value. Any suggestions? Thanks!

Product Version: UE 4.10
Tags:
more ▼

asked Apr 10 '16 at 10:21 PM in C++ Programming

avatar image

Boagz
50 14 21 28

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

1 answer: sort voted first

Just append a .(axis) to the value. For example,

MyVector.X

Will be the X value of the vector. The same works for angles, but with pitch, yaw, etc.

Actually, in general, if you append a -> or . to an object (depending on if it's a pointer or not), Intellisense will (sometimes very slowly) tell you the values and functions you have access to. Pretty useful for when you're not sure what you're looking for or if what you're looking for exists.

more ▼

answered Apr 10 '16 at 11:31 PM

avatar image

KingCole32
180 9 9 12

avatar image Boagz Apr 10 '16 at 11:36 PM

Wow, so simple lol. Thank you very much.

avatar image virtual_method Jun 02 '17 at 11:09 AM

Mark this as answered please

(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