Hello,
Although I’m quite new to Unity, I have managed to setup a working control scheme for my VR application using Input Actions set to “Invoke Unity Events”.
Then I wrote a script “PlayerControls” to handle the inputs like rotation and movement.
Example function that rotates my VR rig around Y axis in response to right handed thumbstick
(deadzone, and curve boolean are public variables).
public void R_axis(InputAction.CallbackContext context)
{
if (context.performed)
{
Vector2 axis = context.ReadValue<Vector2>();
if (Mathf.Abs(axis.x) > axis_deadzone)
{
if (axis_squared_curve)
{
axis.x = axis.x * axis.x * Mathf.Sign(axis.x);
}
Debug.Log(axis);
character_transform.transform.Rotate(new Vector3(0, axis.x * Time.deltaTime * camera_rotation_speed, 0));
}
}
}
Then I selected the “Player Input” component on my VR rig to use my input actions here “InputMaster” to call specific functions from the script.
It seems to work quite good, just a little bit jittery.
Could it be the problem of updating transforms at the same time as valid input is detected? Is there a better, more robust and simple method to implement input or is it as good as it gets?