Skip to main content
Bumped by Community user
edited tags
Link
Vaillancourt
  • 16.4k
  • 17
  • 55
  • 61
Source Link

How to move Character according to Camera's look direction?

    Vector3 newPosition = new Vector3(-horizontal, 0.0f, -vertical);
    transform.LookAt(newPosition + transform.position);
    transform.Translate(newPosition * MoveSpeed * Time.deltaTime, Space.World);

I'm developing 3d mobile game, you can look around with hold&sliding the right side of the screen and move with virtual joystick.

Goal;

Moving character to camera's lookDirection

Issue is;

When i push joystick up, character moves to the same direction (world related)

And I'm not good at coding that's why i can't solve the problem myself, i would be glad if you help me