# Can I implement basic physics on cubes without writing code?

So I’m creating a game that uses cubes as the meshes for everything. I will relay all the detail through textures (animated when needed).
The game is so simple I dont really even need gravity or forces etc. I really just need to keep to cubes from intersecting. Is there a way to do this with the existing rigidbody/collision mesh without too much coding?

Edit: For clarity, this is how I’m implementing things. The player and all environment objects have cube collision meshes and rigidbodies. I’m affecting the transforms of the player to move him around. Note: rigidbody.MovePosition works as well. Its what I have in place now but it doesn’t seem to make a difference. When the player hits say a table (whose collision mesh is about half the height of the player) the player goes flying off into space. This is not the kind of physics I’m looking for. I don’t need authentic gravity or rotational forces. I want the cubes to always be oriented the same way and to stay on the ground (I guess that I would just attempt moving the player down x units each frame to simulate gravity). All I need from the physics engine is to prevent objects from overlapping.

Here’s another way of putting it: I want to the physics engine to limit motion rather than have it attempt to move things in response.

I know how to write things like this in 2D, and I could probably do it for my game, but then, that’s the sort of reason I wanted to use Unity in the first place (but in relation to Networking rather than physics.)

You want Colliders (in your case, BoxCollider) with no Rigidbody on objects that you want to collide with, but not push around.

You want a Rigidbody and a Collider (in your case, BoxCollider is fine) on your player. For the Rigidbody, freeze rotation. To move the player, you should be able to use `rigidbody.MovePosition(transform.position + someVelocity*Time.fixedDeltaTime)` in a `FixedUpdate()` method in a script attached to your player. You want to use FixedUpdate() for moving objects, since that’s the update method used for physics (since it runs at fixed intervals, and occasionally runs multiple times per frame to keep up with the Engine’s physics update loop).

Flying off into space as you were saying would only happen if your player’s collider ended up intersecting the other collider, perhaps from using transform.Translate() instead of rigidbody.MovePosition(). rigidbody.MovePosition() should never result in intersections with colliders that don’t have rigidbodies, as far as I know.