Smooth Camera Positioning
public Transform Target; public float CameraSpeed = 5; public float RX = 15; public float RY = 0; public float RZ = 0; // Update is called once per frame void UpdateRead More…
public Transform Target; public float CameraSpeed = 5; public float RX = 15; public float RY = 0; public float RZ = 0; // Update is called once per frame void UpdateRead More…
void Start () { GameObject instance = Instantiate(Resources.Load(“Cube1”, typeof(GameObject))) as GameObject; } Instantiate object from resources folder. Replace Cube1 for your object name.
RaycastHit hit; void Update () { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) { Ray ray = GetComponent<Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { print(hit.transform.name); print(hit.point); //snap to grid once selected. hit.transform.position = new Vector3(Mathf.Round(hit.transform.position.x), Mathf.Round(hit.transform.position.y),Read More…
Testing
Track Movement By Camera public Transform target; // The distance in the x-z plane to the target public float distance = 15; // the height we want the camera to be aboveRead More…
You gotta add your collision Cubes for this to work. See CubeRaider for more info. public GameObject CUBE; // Use this for initialization void Start () { } // Update is calledRead More…
All the needed Code for Flip and Move. //Track Cube Movement And Location in map By X/Z Count Movement public float FromZFront = 0f; public float ToZFront= 0f; public float FromZBack =Read More…
public Animator Animation; public float AnimationLocation = 0f; void Start() { Animation = GetComponent<Animator>(); } void Update(){ if (Input.GetKeyDown(KeyCode.W)) { //Param: AnimationName, Layer, StartTime Animation.Play(“AnimationNameHere”, -1, AnimationLocation); } }
This is more like targeted movement. One click moves you from a set of coordinates to the next. public float TravelTime = 0f; public float Speed = 2; void Update(){ transform.position =Read More…