How to organize the movement of the character based on the incoming Vector3?

All good!

Here is the code snippet that causes the object to move:
Vector3 InputVector = joystick.GetInputVector();

this.gameObject.transform.position += InputVector * 3 * Time.deltaTime;

The problem is that when turning the character (if I turned it 45 degrees to transform.rotation.x for example) and the joystick moves the character forward, it goes sideways, that is the direction in which he was turned initially, I would like to achieve moving forward (left, right, backward) relative to the camera, that is, if the character is facing to the South, and I pull the joystick forward to move character to South.

What tell about this?

Thank you all in advance. I apologize for the wording of the question, I am still very green.
August 19th 19 at 23:12
2 answers
August 19th 19 at 23:14
For such purposes suitable Transform.TransformDirection. The joystick gives you the direction in local coordinates of the character, and you want to change the world coordinates. Take a vector from the joystick, convert using TransformDirection, and then use the new vector as before.
August 19th 19 at 23:16
Make the character the parent object, and apply twists to it, and the movement set localPosition of the character.

Find more questions by tags Unity Game Engine