transform.position and scale
Hello Everyone, I am looking for the best way to script the camera to move once to a specific x,y,z coordinate, as well as increase the size of another specific gameobject upon voice command. I am going to use Speech Input Handler to activate the script because it is for the HoloLens. Could someone help me out with this? Thanks!
Answer by tpaddock · Apr 13, 2018 at 01:49 AM
I have been able to make the camera move to the location with the following script: (Re-scale with a similar as well)
The only issue I have is that it jumps to the location instead of moving slowly... Any help would be appreciated.
using System.Collections; using System.Collections.Generic; using HoloToolkit.Unity; using UnityEngine;
public class CalgaryOneCameraOne : MonoBehaviour { private float Speed = 1f; Vector3 cameraposition; void Start() { cameraposition = new Vector3(2.25f, -12.94f, -8.9f Speed Time.deltaTime); }
 void Update()
 
 {
     transform.position = cameraposition;
 }
 
               }
Sorry. Here it is...
 using System.Collections;
 using System.Collections.Generic;
 using HoloToolkit.Unity;
 using UnityEngine;
 
 public class CalgaryOneCameraOne : $$anonymous$$onoBehaviour
 {
     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;
     }
 }
                 I have the camera moving to the gameobject relatively easily with the following simple code: Now I just need a piece of code to attach to the gameobject that will rescale it. Any help would be great!
 using System.Collections;
 using System.Collections.Generic;
 using HoloToolkit.Unity;
 using UnityEngine;
 
 public class CalgaryOneCameraOne : $$anonymous$$onoBehaviour
 {
     
 public float speed;
 
     void Update()
     {
         transform.position = Vector3.$$anonymous$$oveTowards(transform.position, new Vector3(2.25f, -12.94f, -8.9f), .01f);
     }
 
 }
                 Your answer