# Collision problem

I’m trying to make a remake of a game on the ps2 in unity using C# and one of the objects within the game acts very strangely to me at least but I don’t know how to recreate it in unity.

Lets say there is 3 of these objects, 2 at the bottom and one on top of the two. The objects will always look at the player when they come close but when they rotate, they never collide with each other so my guess is they are set to not collide with the same object but collide with the player. Though that doesn’t make sense as the object balancing on top of the other two is perfectly fine, so there must be collision or else that top object would just fall through the other two below it.

My guess at first is that the objects had no gravity but that must also be wrong since if you destroy the two blocks under the top block then the top block will fall down.

Does anyone have any idea how i can do this in unity?

You shouldn’t change the transform of the object. Rather use the physics engine, so use add torque or use a motor.

You could make this happen using multiple colliders. Add an Empty game object as a child of the object and add a box collider to it. Shrink the collider on the object and the empty game object and move them so they look like in the picture.

The next step is to create 2 new layers, one for the empty and one for your game object. Go to Edit->Project Settings->Tags and Layers and add two new layers.

Assign one layer to each of the objects, then go to Edit->Project Settings->Physics and change the collision matrix so the layers collide with each other, but not with themselves.

That will allow them to rotate without colliding with each other, while still being able to stack.

I’d say you just want the bottom two that are next to each other to not collide (so that they can turn “through” each other) but still have the top one collide with both of the bottom ones. This is really easy, just tell the physics engine to ignore collisions between the 2 bottom objects using Physics.IgnoreCollision