Currently, I’m doing an HTC Vive project, and the character which player control is moved by touching on the touch pad. Here is the specific line of code that controls how the character moves currently:
body.MovePosition (new Vector3 (body.position.x + vector.x * 3 * Time.deltaTime, body.position.y, body.position.z + vector.y * 3 * Time.deltaTime));
The vector.x and vector.y are the components of the coordinate which gets from the touch pad. They contain values ranged from -1 to 1, and they are used to control the direction and speed of the character’s movement. However, I don’t know how to add something like transform.forward in the formula to make the character’s movement based on the direction it faced. So is it possible to add transform.forward or other direction to the formula like this? If yes, how can I change the formula?