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.

Scaling an object

I am trying to make a hologram in unity like mircrosoft's holograms with clickable corners that will be used to scale the hologram. Anyone have an suggestions on how to do this. I've hit a wall. What I've done so far is add cubes to each corner to act as collision boxes for when the gaze and corner is selected, but I can't figure out a script to scale the model that is a sibling of my corners. Thanks in advance for the help.

Tagged:

Best Answer

Answers

  • @Alec_H,
    I would recommend using the manipulation gesture to scale your object. Depending on the experience you desire, you may or may not want to add some gesture scaling rather than keeping it at a 1:1 ratio of hand movement to object scaling.

    Have you taken a look at the Holograms 211: Gestures course? The GestureAction script (Chapter 4) shows an example of how to use the manipulation gesture to move an object in the scene.

    Thanks!
    David

  • Alec_HAlec_H ✭✭

    @DavidKlineMS Yes, I looked at this tutorial and am able to move my object no problem, but I am wanting to be able to scale the object like you can with the MS holograms. I think it's going to take the code @HoloSheep and some of the 211 tutorial to achieve my final goal. Thank you both of you!

  • Any progress about this question? have you figure out how to scale-up/down with clickable corner?

  • Alec_HAlec_H ✭✭

    @mARkus No I haven't been able to do it yet. I have gotten it to scale with voice commands, but that's not what I want my final product to do. I will update once I figure it out.

  • Alec_HAlec_H ✭✭
    edited July 2016

    I've tried a few things with the GestureAction code given in one of the tutorials. Ideally I would like it to be a 1:1 fixed scale but right now this code just makes my object vanish and I'm not sure why. @HoloSheep @DavidKlineMS any suggestions on what's going wrong?
    `using UnityEngine;

    ///

    /// GestureAction performs custom actions based on /// which gesture is being performed. ///

    public class Cubscript : MonoBehaviour
    {
    [Tooltip("Rotation max speed controls amount of rotation.")]

    private Vector3 manipulationPreviousPosition;
    
    private float rotationFactor;
    private float xx, yy, zz;
    
    void Update()
    {
        PerformRotation();
    }
    
    private void PerformRotation()
    {
        if (GestureManager.Instance.IsNavigating && HandsManager.Instance.FocusedGameObject == gameObject)
        {
            /* TODO: DEVELOPER CODING EXERCISE 2.c */
    
            // 2.c: Calculate rotationFactor based on GestureManager's NavigationPosition.X and multiply by RotationSensitivity.
            // This will help control the amount of rotation.
            xx = GestureManager.Instance.NavigationPosition.x;
            yy = GestureManager.Instance.NavigationPosition.y;
            zz = GestureManager.Instance.NavigationPosition.z;
            // 2.c: transform.Rotate along the Y axis using rotationFactor.
            this.gameObject.transform.localScale = new Vector3(1 * xx, 1 * yy, 1 * zz);
    
        }
    }
    
    void PerformManipulationStart(Vector3 position)
    {
        manipulationPreviousPosition = position;
    }
    
    void PerformManipulationUpdate(Vector3 position)
    {
        if (GestureManager.Instance.IsManipulating)
        {
    
            /* TODO: DEVELOPER CODING EXERCISE 4.a */
    
            Vector3 moveVector = Vector3.zero;
    
            // 4.a: Calculate the moveVector as position - manipulationPreviousPosition.
            moveVector = position - manipulationPreviousPosition;
    
            // 4.a: Update the manipulationPreviousPosition with the current position.
            manipulationPreviousPosition = position;
    
            // 4.a: Increment this transform's position by the moveVector.
            transform.position += moveVector;
    
    
    
    
        }
    }
    

    }`

  • Hi,
    I search exactly the same? Are you got any results?

    Pad

Sign In or Register to comment.