I am building a game where there is a cube (the player)who needs to get through gates on a track. I wrote a motor script and now the colliders don’t work. Why? I can not for the life of me figure this out. I think it has something to do with the script.
using UnityEngine;
using System.Collections;
public class testMotor
: MonoBehaviour {
public float MoveSpeed = 10;
public float RotateSpeed = 40;
void Start()
{
}
// Update is called once per frame
void Update ()
{
// Amount to Move
float MoveForward = MoveSpeed * Time.deltaTime;
float MoveSide = Input.GetAxis("Horizontal") * MoveSpeed * Time.deltaTime;
// Move the player
transform.Translate(Vector3.forward * MoveForward);
transform.Translate(Vector3.right * MoveSide);
}
}
also the cube is the parent with the script, a mesh renderer and a mesh collider. It has 2 child objects: a camera and a spotlight. The walls are just planes with mesh renderers and colliders on them.
thank you