Código: Selecionar todos
using UnityEngine;
using System.Collections;
public class spider_contrrol : MonoBehaviour
{
private int act = 0;
private int nomove = 0;
public float smooth = 2.0F;
Rigidbody m_Rigidbody;
Animator m_Animator;
SphereCollider m_Collider;
void Start () {
m_Animator = GetComponent<Animator> ();
m_Rigidbody = GetComponent<Rigidbody> ();
m_Collider = GetComponent<SphereCollider> ();
}
// Update is called once per frame
void Update () {
if (nomove <= 0) {
float horizontal = Input.GetAxis ("Horizontal") * 2;
float vertical = Input.GetAxis ("Vertical") * 2;
if (Mathf.Abs (horizontal) + Mathf.Abs (vertical) > 0) {
act = 1; {
Vector3 p = transform.position;
Vector3 t = new Vector3 (transform.position.x + (horizontal*3), transform.position.y, transform.position.z + (vertical*3));
Vector3 d = t - p;
d.y = 0;
Quaternion newRotation = Quaternion.FromToRotation(Vector3.forward, d);
}
} else
act = 0;
if (Input.GetKeyDown ("x")) {
act = 5;
horizontal = 0;
vertical = 0;
}
m_Rigidbody.velocity = new Vector3 (horizontal, 0, vertical);
} else
nomove -= 1;
m_Animator.SetInteger("act", act);
}
}
Não sou iniciante, sou profissional em game maker e agora to aprendendo Unity