NavigationUpdated, Object move from Camera direction.

Good morning.

I would be very grateful if I could answer this question.

I did not speak English and I used Google Translator.

I am developing an App using Hololens and Unity.

Using a gesture to move the object in the direction
Goal.

We have confirmed that the y and z axes are now properly implemented and distributed to Hololens, so that they work normally.

But the x-axis does not know the correct answer.

Here is my code:

public void NavigationUpdated(InteractionManager.InteractionEventArgs args)
    {
        txtDebug.text = string.Format("args == X : " + args.Position.x + " Y : " + args.Position.y + " Z : " + args.Position.z);
        txtDebug2.text = string.Format("newPos == X : " + gameObject.transform.position.x + " Y : " + gameObject.transform.position.y + " Z : " + gameObject.transform.position.z);
       
        Vector3 heading = this.gameObject.transform.position - XVeil.Instance.HeadTransform.position;
        var distance = heading.magnitude;
        var direction = heading / distance;

        if (args.Position.x == 1 || args.Position.x == -1)
        {
            // this is Problem
            Vector3 vec = new Vector3(args.Position.x, 0, 0f);
            Vector3 moveDirection = (this.gameObject.transform.position - XVeil.Instance.HeadTransform.position).normalized;
            Vector3 newPos = Quaternion.Euler(moveDirection.x, moveDirection.y, moveDirection.z) * vec;
            this.gameObject.transform.position += offset * vec;
        }
        else if (args.Position.y == 1 || args.Position.y == -1)
        {
            // this is OK
            Vector3 vec = new Vector3(0f, args.Position.y, 0f);
            this.gameObject.transform.position += offset * vec;
        }
        else if (args.Position.z == 1 || args.Position.z == -1)
        {
            // this is OK
            this.gameObject.transform.position += direction * offset * args.Position.z;
        }
    }

You can try using the args position to get the z position as well to allow you to get the correct rotation to allow the object to rotate around