Why my box collider object goes into another box collider object?

Hi All,

I am just making an vernier calipers. In that i want to find the length of a cube.

For vernier scale i add the box collider. and x axis moving code.

I just taken a cube and i placed that above of the vernier calipers.

when ever i drag my vernier scale that goes through the cube. how will i fix that?

you can find my vernier scale and cube inspectors.

many good beginner articles on physics, etc, at unityGEMS.com search on here for 100s questions on physics, colliders, rigidbody, etc etc

1 Answer

1

Add a rigidbody. You are directly changing the position in code and so box colliders will have no effect. Try using a rigidbody and adding force to move them.