Question by 
               Hjalmarr13 · Feb 16 at 11:41 AM · 
                movementmovement scriptmovements  
              
 
              Continous movement issue
Hi! Following a tutorial on how to do continous movement in unity (testing vr). I first succeeded with it, but when I added this part to it (that the movement would follow headset) nothing happens - why? Issue:
         Quaternion headYaw = Quaternion.Euler(0, rig.cameraGameObject.transform.eulerAngles.y, 0);
 
         Vector3 direction = headYaw * new Vector3(inputAxis.x, 0, inputAxis.y);
When I delete the first line fully (Quaternion headYaw) and delete the "headYaw" from second line I can move again - why this happens?
full code
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.XR;
 using UnityEngine.XR.Interaction.Toolkit;
 
 
 public class ContinousMovement : MonoBehaviour
 {
     
     public float speed = 1;
     public XRNode inputSource;
     public LayerMask groundLayer;
 
     private XRRig rig;
     private Vector2 inputAxis;
     private CharacterController character;
 
     // Start is called before the first frame update
     void Start()
     {
         character = GetComponent<CharacterController>();
         rig = GetComponent<XRRig>();
     }
 
     // Update is called once per frame
     void Update()
     {
 
        InputDevice device = InputDevices.GetDeviceAtXRNode(inputSource);
        device.TryGetFeatureValue(CommonUsages.primary2DAxis, out inputAxis);
     }
 
     private void FixedUpdate()
     {
 
         Quaternion headYaw = Quaternion.Euler(0, rig.cameraGameObject.transform.eulerAngles.y, 0);
 
         Vector3 direction = headYaw * new Vector3(inputAxis.x, 0, inputAxis.y);
 
         character.Move(direction * Time.fixedDeltaTime * speed);
         
 
 
     }
 
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Jumping in my script deosnt work,How make this script to jump? 0 Answers
Character Rotation 0 Answers
Movement acceleration 1 Answer
How can I state the movement speed of this script? 0 Answers
My controls are wierd 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                