Answers for "unity translate"

C#
1

hot to move pobject unity

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        // Move the object forward along its z axis 1 unit/second.
        transform.Translate(Vector3.forward * Time.deltaTime);

        // Move the object upward in world space 1 unit/second.
        transform.Translate(Vector3.up * Time.deltaTime, Space.World);
    }
}
Posted by: Guest on March-18-2020
0

transform.Translate unity

transform.Translate(1 ,1 ,1); //where coordinates are x, y and z respectively

//Similarly you can also use:
int speed; //variable
transform.Translate(Vector3.forward * Time.deltaTime * speed); //for moving along z axis
Posted by: Guest on July-28-2021

C# Answers by Framework

Browse Popular Code Answers by Language