Object moves to the target position

Source: Internet
Author: User

Movetowards:
void Update ()

{

    float Step = speed * time.deltatime;

  GameObject.transform.localPosition = Vector3.movetowards (gameObject.transform.localPosition, new Vector3 (10, 3  , (), step);

}

Interpolated values

  void Update ()

{

    float Step = speed * time.deltatime;

GameObject.transform.localPosition =New Vector3 (Mathf.lerp (gameobject.transform.localposition.x, ten, Step),

Mathf.lerp (GAMEOBJECT.TRANSFORM.LOCALPOSITION.Y, -3, Step), Mathf.lerp (Gameobject.transform.localposition.z, 50, Step));

}

Iween

Itween.moveto (M_uibgcamera, Itween.hash ("x", -20, "Y", -3, "Z", "Time", 1.0, "Islocal", true ));

Ctrip

Startcoroutine (Movetoposition ());

      IEnumerator movetoposition ()
       {  
        Gameobject M_uibgcamera = Gameobject.find (

"Ui/fengmian/uibgcamera"); while (m_UIbgCamera.transform.localPosition! = New Vector3 ( -5, -3,))

         
       {   
          
        m_UIbgCamera.transform.localPosition = Vector3.movetowards (m_UIbgCamera.transform.localPosition,

New Vector3 ( -20, -3, ten), time.deltatime);

Yield return 0;

}

}




Object moves to the target position

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.