Announcement

Collapse
No announcement yet.

Get actor location with some kind of world coordinate rotation?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Get actor location with some kind of world coordinate rotation?

    Hi guys

    I wonder is that possible to calculate Actor "World" Location but with some recalculation where we rotate out world coordinate system so that world X axis are always parallel to Actor X (forward) axis?
    Here's the picture:

    Now: out character move forward and make 10 steps, so his new location after that will be - X 10, Y and Z - doesnt matter. Then we rotate out cameram for example to 90 deg. now if we again make 10 steps our new X will still be 10, cause we now travel along Y world axis, and Y axis will be - 10.
    That i need: no matter how we rotate camera, if we move forward, character location will increase, if we move backward character location will decrease cause we rotate world coordinate syste and world X are still parallel to character X.


    #2
    I assume you want your character to only move at the x-axis and without animations i would do it like this:
    1.) In Project settings set W and S for X-Axis. W has scale 1 and s has scale -1
    2.) In Character BP i would add the input events
    3.) Add "Set Actor World Location" and "Get Actor World Location"
    4.) Split the structure pins of both nodes and connect all from Get to Set except the X-Axis-Value
    5.) Get the scale from the Input Event, multiplicate it with for example 5
    6.) Get the Rsult and add it to the current Location and set this value as new X-Location

    I don't have UE4 open yet, so maybe i used some wrong terms but this should at least change the location of your character on the x-axis

    Comment


      #3
      Originally posted by MisterHB212 View Post
      I assume you want your character to only move at the x-axis and without animations i would do it like this:
      1.) In Project settings set W and S for X-Axis. W has scale 1 and s has scale -1
      2.) In Character BP i would add the input events
      3.) Add "Set Actor World Location" and "Get Actor World Location"
      4.) Split the structure pins of both nodes and connect all from Get to Set except the X-Axis-Value
      5.) Get the scale from the Input Event, multiplicate it with for example 5
      6.) Get the Rsult and add it to the current Location and set this value as new X-Location

      I don't have UE4 open yet, so maybe i used some wrong terms but this should at least change the location of your character on the x-axis
      Thanks! But actually - nope, my character can walk in any directions like typical first person character

      Comment

      Working...
      X