Making isKinematic False When Hit By Colliding Gameobject

Alright, so essentially what I’m looking for is when a bullet collides with another gameobject, it causes it to fall or be moveable again. For instance, a bullet hits a brick wall, turning off the kinematics of the bricks and pushing them inward to expose a hole for the player to walk through.

Here’s my current code:

var projectile : Rigidbody;
var speed = 20;
var rate : float = 0.5;
private var rate_time : float;
 
    function Update()
    {
       if( Input.GetButtonDown("Fire1") && Time.time > rate_time)
       {
          rate_time = Time.time + rate;
          var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation );
          instantiatedProjectile.rigidbody.AddForce(instantiatedProjectile.transform.forward * speed);
          Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider );
       }
    }

Any help with integrating the code into that or a better suggestion would be much appreciated!

That idea works. For example a barrel on a slope which should stick tight until a bullet knocks it loose. Tricky part is assigning a velocity to a “frozen” (isKin) rigidbody is an error, so you may need lots of if(rigidbody.isKinematic==false) checks.

Just use standard moving bullet code, and add the unfreeze line:

void OnCollisionEnter(Collision cc) {
  if( we hit something to knock around ) {
    cc.rigidbody.isKinematic=false; // <-- just this change to regular bullet hits
       ...