Help! How to get ForwardVector from a FRotator in C++?

When I call ForwardVector from a FRotator, it gives me an error that ForwardVector is not a member of FRotator.

1 Like

FVector Direction = FRotator(0.f, RotateZone.Yaw, 0.f).Vector();

You can always go to classes you’re interested in and see their functions. In this case it’s Rotator.h and the function there is

/**
     * Convert a rotation into a unit vector facing in its direction.
     *
     * @return Rotation as a unit direction vector.
     */
    CORE_API TVector<T> Vector() const;
3 Likes

Thank You very very much, You just solved my problem with a detailed reply , really appreciate .
I am looking in the header files for functions to understand, but for me a little bit solid to understand that’s why I call for help , I am afraid if I will do something not the correct way, it will make worse problems for me in the future )

Sir, Now I can use Direction under AddMovementInput(Direction, Axis) ?

Yes. I don’t know what RotationZone is, but if it works in blueprints, it will work in C++.

1 Like

Yes I tried, and working perfectly, and the RotationZone is the area in which the wind rotates and it takes any object with it and rotates them, this area is spawning randomly on different locations on the map and if player get into it , the player starts rotating with it and loose some amount of health…
rotator

1 Like