Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Rotation Bug

Hey guys I have a Part Object with numerous children objects. Now I have each child setup to rotate when the gaze manager hits the named game object. However on about 10% of the children it doesn't seem to rotate the object but on the other 90% it does. The scripts are pretty much modified from the tutorials to learn and get the hang of HoloLens. But I am unsure why 10% doesn't work. They all have colliders and the gaze does recognize hitting the objects however most parts work, but a few don't.
[code]
using HoloLensIntro.HoloToolkit.Unity;
using UnityEngine;

public class GestureAction : MonoBehaviour
{
public float RotationSensitivity = 10.0f;
public GameObject ObjectRotation;

private Vector3 manipulationPreviousPosition;

private float rotationFactor;
void Update()
{
    PerformRotation();
}

public void PerformRotation()
{
    if (GestureManager.Instance.IsNavigating && InteractibleManager.Instance.FocusedGameObject == ObjectRotation)
    {
        float rotationFactor_Y = GestureManager.Instance.NavigationPosition.x * RotationSensitivity;

        float rotationFactor_X = GestureManager.Instance.NavigationPosition.y * RotationSensitivity;

        if (GazeManager.Instance.Hit == ObjectRotation)

            ObjectRotation.transform.Rotate(new Vector3(rotationFactor_X, -1 * rotationFactor_Y, 0));

    }
}

void PerformManipulationStart(Vector3 position)
{
    manipulationPreviousPosition = position;
}

void PerformManipulationUpdate(Vector3 position)
{
    if (GestureManager.Instance.IsManipulating)
    {
        Vector3 moveVector = Vector3.zero;
        moveVector = position - manipulationPreviousPosition;
        manipulationPreviousPosition = position;
        transform.position += moveVector;
    }
}

}
[\code]

Best Answers

  • Options
    Answer ✓

    Hey @james_ashley just wanted to say thank you for setting me on the right path. I Reimported the file this time without it being grouped. and made 2 different instances to test one being just the object and another within an empty gameobject and both of them items and all their prefab children work. So Important note to self, to not have everything grouped while exporting. Thank you again for your help.

  • Options
    james_ashleyjames_ashley ✭✭✭✭
    Answer ✓

    Awesome!

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

Answers

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    @AvionicHologram ,

    The few times that's happened to me, it's because another collider is intercepting the gaze. Your code looks fine. If you spread out your objects differently (or just resize all of them) does the same thing happen?

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options

    @james_ashley I haven't tried resizing the objects however I have spread them out to the other side (to an area that is blank with nothing else around) and the item still wont rotate. I know the object is being hit by the gaze cause my cursor transform while over the objects and if they are air tapped their animation is triggered. I believe it is something with the hierarchy, cause the moment I remove the objects from their parent, it removes them from the prefab animation(which is expected) and they then are able to be rotated. Unless I am going crazy I have the same scripts in the same setup as the other objects. I am just not sure why 10% of the parent objects children wont rotate while the other 90% do. I have attached a screenshot of their hierarchy. The breather works just fine and is even close to other colliders while the Pressure Transducer wont rotate.


  • Options
    james_ashleyjames_ashley ✭✭✭✭

    In case it has to do with the Pressure Transducer model itself rather than your script - have you tried to create a custom script that has constant rotation (rotate on start instead of the gaze event) just to test?

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options

    @james_ashley thanks for the idea, like an idiot the thought of trying that completely eluded me. I did what you recommended and you are right. Even with the constant rotation on start it wont rotate. I then created a standard ball with multiple colored sides with the same script (once with my gaze and once with my constant rotation on start) and it worked with both. I removed the Pressure Transducer from the parent object and again both scripts worked. So there is apparently something with the parent object that is making some objects work and others not work. I imported the objected grouped so going to try ungrouping the objects then importing.

  • Options
    Answer ✓

    Hey @james_ashley just wanted to say thank you for setting me on the right path. I Reimported the file this time without it being grouped. and made 2 different instances to test one being just the object and another within an empty gameobject and both of them items and all their prefab children work. So Important note to self, to not have everything grouped while exporting. Thank you again for your help.

  • Options
    james_ashleyjames_ashley ✭✭✭✭
    Answer ✓

    Awesome!

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

Sign In or Register to comment.