My problem is that when the player hits a wall, it ignores it as if it is not an object. both objects have a collider and the player has a rigidbody. This is my script
c#
using UnityEngine;
using System.Collections;
public class Game : MonoBehaviour {
public float speed = 0.3f;
public Rigidbody rb;
public GameObject floor;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.D)) {
rb.MovePosition(transform.position + transform.forward * speed);
} else if (Input.GetKey (KeyCode.A)) {
rb.MovePosition(transform.position - transform.forward * speed);
}
if (Input.GetKey (KeyCode.Space)) {
Destroy (floor);
}
}
}