- Home /
All colliders no longer work.
I was switching out primitive colliders with mesh colliders for game objects when my colliders stopped working with terrain. I was autogenerating the colliders from the object mesh, with convex selected, but it fell through the floor, even when placed well above the terrain, there was no collision detection. I have a simple script attached, but i do not think it would affect the coliders.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveController : MonoBehaviour {
[SerializeField] private GameObject Turret;
[SerializeField] private GameObject Base;
[SerializeField] private float moveSpeed;
[SerializeField] private float turnSpeed;
public Rigidbody baseRB;
// Use this for initialization
void Start ()
{
baseRB = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
Turret.transform.position = Base.transform.position;
if (Input.GetKey(KeyCode.W))
{
baseRB.AddRelativeForce(Vector3.up * moveSpeed);
}
if (Input.GetKey(KeyCode.A))
{
transform.Rotate(Vector3.back * turnSpeed);
}
}
}
I know there are issues with mesh colliders and terrain collision, but i thought the convex mesh fixed that, but once I gave up and switched the collider back to a Box collider, that did not work either. When i switched the terrain out for a plane, they still went through eachother. I have rebuilt the scene from scratch and it seems to be working, but what could have caused this?