Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI not usable while moving root transform (UI inside a moving vehicule) #11769

Closed
scardin opened this issue Aug 18, 2023 · 0 comments
Closed

Comments

@scardin
Copy link

scardin commented Aug 18, 2023

This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:


Describe the bug

We would like to interact with UI inside a moving vehicule.
When animating the root transform of a VR interactive scene the UI becomes barely interactable.
We tried to animate the root transformn using the different unity methid Update, LateUpdate, FixedUpdate. While fixed update animation sliding

To reproduce

Steps to reproduce the behavior:

  1. Open the MRTKDevTemplate Unity project
  2. Select the Canvas example scene
  3. Create an empty game gmae object root in the hierarchy
  4. Move everyhting as child of this root gameobject
  5. Animate the root gameobject using script
  6. Interaction in VR is broken (especially slider)

Expected behavior

I expect that the UI can be interacted correctly in VR while moving (as the player is inside a vehicule)

Screenshots

screenshot

image

video

https://youtu.be/rGhPN-9CaFY

Your setup (please complete the following information)

  • Unity Version [e.g. 2022.3.6f1]
  • MRTK Version 3 - branch mrtk3 - Commit c86b0e9

Target platform (please complete the following information)

  • OpenXR - Windows Quest link

Animation script

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RootAnimation : MonoBehaviour
{

    public MODE mode = MODE.NONE;

    public float rotationSpeed = 50.0f;
    public float translationSpeed = 5.0f;

    float time = 0;

    public bool rotate = false;

    public enum MODE
    {
        NONE,
        UPDATE,
        LATEUPDATE,
        FIXEDUPDATE,
    }

    // Update is called once per frame
    void Update()
    {
        if (mode == MODE.UPDATE)
        {
            Animate(Time.deltaTime);
        }
    }

    private void LateUpdate()
    {
        if (mode == MODE.LATEUPDATE)
        {
            Animate(Time.deltaTime);
        }
    }

    private void FixedUpdate()
    {
        if (mode == MODE.FIXEDUPDATE)
        {
            Animate(Time.fixedDeltaTime);
        }
    }

    public void Animate(float deltaT)
    {
        time += deltaT;

        float normTranslation = translationSpeed * deltaT * Mathf.Sin(time);
        transform.Translate(normTranslation, normTranslation, normTranslation);

        if (rotate)
        {
            float normRotation = rotationSpeed * deltaT;
            transform.Rotate(normRotation, normRotation, normRotation);
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants