# How to prevent a cube from falling through a plane in Unity

I am trying to prevent a player cube from falling through the plane (Battleground) in Unity, but after adding Mesh collider to both the cube and plane, as well as adding a rigidbody, nothing seems to work. The only way I can prevent this from happening is by locking the y axis of the cube, but this is a problem because I am adding in a jumping ability, and the player needs to be able to fall of the map. Is this something I can do within the Unity editor, or do I need to make a script that does that.

To verify, all 3 colliders have "Is Trigger" Enabled, the platform is not designed to be moved, so the X, Y and Z of both the plan's rotation and position are locked, and the material for the colliders are all default. Each of the cubes and the plane's material are custom (Not the collider's material). The X, Y and Z of the cube's rotation are locked. Both cubes have the tag 'player'

The code for player movement is:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMove : MonoBehaviour {
private Rigidbody rb;
// Use this for initialization
void Start() {
rb = GetComponent<Rigidbody>();
}

//Update is called once per frame
void FixedUpdate() {
float h = Input.GetAxis("Horizontal") * 5;
float v = Input.GetAxis("Vertical") * 5;

Vector3 vel = rb.velocity;
vel.x = h;
vel.z = v;
rb.velocity = vel;
}

}
$$$$
`
• Show us your code for how you're moving the cube. The usual mistake here is moving the cube with the Transform component instead of with collision-aware physics methods. Also, you'll likely want to use a box collider over a mesh collider whenever your case allows. – DMGregory Aug 23 '19 at 1:37
• @DMGregory I added that in. The problem is, I only know how to make it move with transform – Wendy Aug 23 '19 at 2:06
• That's surprising, since the code you've shared does it the right way with a rigidbody, not with the transform. ;) So there's something else going on. Do you move the plane at all? Are either of the colliders marked as triggers? Please show us the complete steps we need to reproduce this problem in a new empty project, so we can help you spot what's wrong and test solutions. – DMGregory Aug 23 '19 at 2:10
• @DMGregory I added in a few more details into the question. Hopefully that is enough detail. – Wendy Aug 23 '19 at 3:04
• Don't mark the colliders as triggers. That says "these colliders should not be solid" — if you uncheck IsTrigger, does anything change? – DMGregory Aug 23 '19 at 3:06