InputModule.SimulateInputFromController C# (CSharp) Method

SimulateInputFromController() public method

public SimulateInputFromController ( JsonData &data ) : void
data JsonData
return void
    public override void SimulateInputFromController(ref JsonData data)
    {
        // Set movement
        Quaternion curRotation = _myAvatar.transform.rotation;
        Vector3 targetVelocity = Vector3.zero;
        targetVelocity.x = Input.GetAxis("Horizontal");
        targetVelocity.y = Input.GetAxis("Vertical");
        targetVelocity.z = Input.GetAxis("VerticalD");
        targetVelocity = curRotation * targetVelocity;

        // Read angular velocity
        Vector3 targetRotationVel = Vector3.zero;
        targetRotationVel.x = -Input.GetAxis("Vertical2");
        targetRotationVel.y = Input.GetAxis("Horizontal2");
        targetRotationVel.z = -Input.GetAxis("HorizontalD");

        if (Input.GetKey(KeyCode.Space))
            data["teleport_random"] = new JsonData(true);

        //        data["get_obj_data"] = new JsonData(true);
        //        data["relationships"] = new JsonData(JsonType.Array);
        //        data["relationships"].Add("ALL");

        //        // Convert from relative coordinates
        //        Quaternion test = Quaternion.identity;
        //        test = test * Quaternion.AngleAxis(targetRotationVel.z, curRotation * Vector3.forward);
        //        test = test * Quaternion.AngleAxis(targetRotationVel.x, curRotation * Vector3.left);
        //        test = test * Quaternion.AngleAxis(targetRotationVel.y, curRotation * Vector3.up);
        //        targetRotationVel = test.eulerAngles;

        data["vel"] = targetVelocity.ToJson();
        data["ang_vel"] = targetRotationVel.ToJson();
    }