Help my cube wont stop rotating

hi

iam trying to spawn cubes but i dont want them to be able to rotate because it makes building virtually imposible

if(Input.GetButton("Fire2")) { var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.AddComponent(Rigidbody); Rigidbody.FreezeRotation; }

For some reason they wont stop rotating

Also is it possible when the cube is being controled by my physics gun it can be Kinematic and when iy collides with something it goes flyinglike it normaly would

please help:-|

I think this might work:

function Update()
{
    if(Input.GetButton("Fire2")) 
    { 
        var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); 

        cube.AddComponent(Rigidbody);
        cube.rigidbody.freezeRotation = true;
    }
}

The other thing. Hm, if both rigidbodies are kinematic, then there wouldn't be send an event about the collision. Here is something from the documentation:

"Note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached."