- Home /
Object's vectors are not moving with the object, what did i do wrong?
i found a youtube video (Sebastian Lague) that has a really good movement script, i understood it and used it for my character, when i started moving it, i noticed that the character rotates but his blue, red, green vectors are not rotating with him, his forward always stays the same and it was annoying when i implemented rotation by mouse, also in the youtube video his vectors rotated fine with the object, what did i do wrong? please i need this.
Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
Vector2 inputDir = input.normalized;
//if (inputDir==new Vector2 (0,1))
// transform.eulerAngles = new Vector3(0, Camera.main.transform.eulerAngles.y, 0);
//Debug.Log(Input.GetAxis("Mouse X"));
if (inputDir != Vector2.zero)
{
float TargetRot = Mathf.Atan2(inputDir.x, inputDir.y) * Mathf.Rad2Deg;
transform.eulerAngles = Vector3.up * Mathf.SmoothDampAngle(transform.eulerAngles.y, TargetRot, ref TurnSmoothVelocity, TurnSmoothTime);
}
bool running = Input.GetKey(KeyCode.LeftShift);
float TargetSpeed;
if (running == true) TargetSpeed = RunSpeed * inputDir.magnitude;
else TargetSpeed = WalkSpeed * inputDir.magnitude;
CurrentSpeed = Mathf.SmoothDamp(CurrentSpeed, TargetSpeed, ref SpeedSmoothVelocity, SpeedSmoothTime);
transform.Translate(transform.forward * CurrentSpeed * Time.deltaTime, Space.World);
}
Answer by Hellium · Feb 17, 2019 at 11:22 PM
Are you sure the gizmos are not set to global?

Holy shit lol, thanks man so it's that simple, you saved my life.
Your answer
Follow this Question
Related Questions
What is a correct way to move a Drone follow a list of Vector3 points 1 Answer
Lerping euler angles make entire spin 3 Answers
How do I make create a rotateable object that follows a raycast hit point? 2 Answers
How to limit the range of rotation of the world around my player. 0 Answers
Rotate object towards target without influencing AddForce 0 Answers