none
transform.position and scale RRS feed

  • Question

  • Hello Everyone,

    I am looking for the best way to script in c# a unity camera to move once to a specific x,y,z coordinate, as well as increase the size of another specific gameobject upon voice command. This is for the HoloLens.

    Could someone help me out with this?

    Thanks!

    • Moved by Fei Hu Friday, April 13, 2018 2:55 AM Moved Fron C#
    Thursday, April 12, 2018 11:18 PM

Answers

  • Hello Trevor,

    Your question is more related to third party libraries, you could repost a new thread to unity forum for better support.

    If you have some grammar or code errors in using C#, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 13, 2018 2:54 AM

All replies

  • Hello,

     If Unity does not already have library for Speech Rec then you will need

    to code for yourself. Then in Unity script/action call the library routines

    at run time. Your library should return a variable that Unity can handle,

    like speaking "move cam X axis positive 30" returns value as object

    string to Unity.  Or something that Unity can use to take action with.

     You will need to make a list of voice commands and prep code to

    understand and translate into action Unity will understand.  This

    project is not going to be easy and has many steps.

     

     Hope this helps :)

    • Edited by User3DX Friday, April 13, 2018 12:05 AM typo
    Thursday, April 12, 2018 11:56 PM
  • Thanks!

    I have been able to make the camera move to the location with the following script:

    The only issue I have is that it jumps to the location instead of moving slowly... 

    using System.Collections;
    using System.Collections.Generic;
    using HoloToolkit.Unity;
    using UnityEngine;

    public class CalgaryOneCameraOne : MonoBehaviour
    {
        public Transform EndPositionGo;
        private float Speed = 1f;
        Vector3 vector3;
        Vector3 cameraposition;
        void Start()
        {
            cameraposition = new Vector3(2.25f, -12.94f, -8.9f * Speed * Time.deltaTime);
        }
        
        void Update()
     
        {
            transform.position = cameraposition;
        }
    }

    Friday, April 13, 2018 1:33 AM
  • Hello Trevor,

    Your question is more related to third party libraries, you could repost a new thread to unity forum for better support.

    If you have some grammar or code errors in using C#, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 13, 2018 2:54 AM