Collisions are driving me mad! My sanity is fading fast...

A slightly dramatic start to the question, but it paints the picture…

I’m still in the very early stages of learning Unity and scripting. I would like to make a video using the Unity Engine and have a scene in mind:

The Scenario:
I have created a large cube based playing area created using 6 other GameObject cubes to form the top, bottom, and 4 sides. Inside the cube are other cubes. One is the cube which I am controlling as my ‘character’, I am using the mouse for direction and standard FPS keys for forward, backward movement. I am able to move the character cube around inside the playing area in all 3 dimensions. The other cubes are just objects that I would like to be able to push around, also in all 3 dimensions with no gravity applied to them.

The Problem(s):

1: I am looking to have the walls, floors, etc of the playing area stop my character from passing through them. Currently when I do collide with them, my character starts to slowly bounce around inside the playing area, eventually slowing down. I would like to have this happen without any physics being applied to my character so I don’t bounce of anything.

2: I would also like to be able to push around the other cubes that I added but for them to have no gravity but with the physics being applied, so that they bounce around the playing area.

I also need to do this without using the character controller as it’s shape does not fit that of the cube and when I collide with other cubes at an angle, clipping occurs making it look messy and ruins the effect.

So far I have been unable to get all these working together, due to various factors:

The Factors:

To get it partially working I have used a Rigidbody on my character cube with gravity turned off. To get the movement I want (no physics so that I don’t bounce of the walls etc) I set the rigid body to be Kinematic. However when I do this the collisions no longer work and I pass straight through the walls. I have researched various ways round this but with little luck. In fact it seems to be quite a common question with the general answer being use the character controller that comes with Unity. This as mentioned is not an option due to the clipping effect. I have even starting learning OnTriggerEnter and OnCollisionEnter methods to try and achieve my goal using Scripting (Java), by preventing by character cube passing through the cubes that make up the walls. I now have the collision detections working for the walls, but I am unable to get any further. If it helps here is an example of my method:

function OnCollisionEnter(wallCollision : Collision){

if( == "mcube_top"){
Debug.Log("HIT! mcube_top");


Also here is a list of the construction methods I have used for the game objects:

Walls: Cube(Mesh Filter) + Box Collider (No trigger)

Character Cube: Cube(Mesh Filter) + Box Collider (No trigger) + Rigid Body (No Gravity / Is Kinematic) + Movement custom character control script

I also have a camera child and another child in the Character Cube with the following setup so I can get the collision detection working (even if I have kinematic turned on):

Character Cube Child: Cube(Mesh Filter) + Box Collider (Is trigger) + Custom collision script as shown above

The Summary: Move around in three dimensions, have walls stopping my movement without the physics bounce. Move other gravity free cubes in the area. They must also be stopped by the walls. All objects are cubes. Do all this without clipping of the cube edges with other cubes.

So, am I not understanding a fundamental aspect of Unity, is it just me that thinks the whole Kinetic thing is like an evil catch 22 situation, or am I actually on the right track. If so, does anyone want to give me a nudge in the right direction please?



P.S. I hope this makes sense. It took me over half an hour to try and describe this clearly lol!

Your custom movement script should handle stopping the player. Set the player’s velocity to zero when they hit a wall.

Why triggers? Non-trigger, no-gravity rigidbodies will do ‘exactly’ what you describe. If you move the player by setting its velocity instead of altering its position, you’ll also affect the environment through ‘normal’ physics as you move.

“Kinematic” means your code is going to handle all movement, and physics will not affect the object anymore.

Usually the way characters are controlled is to shut off their “real” physics and fake it. The way to have them interact with physics objects in the world is by checking for the collision then manually adding a force push to the object you’re colliding with. Been a while since I’ve done this but something like

function OnCollisionEnter(collision : Collision) {
for (var contact : ContactPoint in collision.contacts) {
// use collision.contacts to get contacted objects
// use rigidbody.AddForce() to push that object away from you

I have no suggestions about fading sanity, if anyone has a solution for that please pass it along.

It just sounds like you need to change some of the physics materials on the objects