My chararcet as colliders. the other objcts have colliders, but my character keeps getting inside of stuff, like walls, the problem i think is in the transform.translate.
could anyoune help me??
My jumping its also bugging any gess??
my character code is here:
using UnityEngine;
using System.Collections;
public class walkperson : MonoBehaviour {
public float velocidade;
public float voo;
public GameObject bala;
public float timeLeft;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Class1.contadorglobal == 0)
{
if (Input.GetKey("w"))
{
transform.Translate(0, 0, velocidade);
timeLeft -= Time.deltaTime;
if (timeLeft < 0)
{
GetComponent<AudioSource>().volume = Random.Range(0.8f, 1);
GetComponent<AudioSource>().pitch = Random.Range(0.8f, 1.1f);
GetComponent<AudioSource>().Play();
timeLeft = 0.5f;
}
}
}
if (Input.GetKey("a"))
{
transform.Translate(-velocidade, 0, 0);
}
if (Input.GetKey("s"))
{
transform.Translate(0, 0, -velocidade);
}
if (Input.GetKey("d"))
{
transform.Translate(velocidade, 0, 0);
}
if (Input.GetKey("space"))
{
transform.Translate(0, velocidade, 0);
}