Skip to content

Instantly share code, notes, and snippets.

@seferciogluecce
Last active August 8, 2020 06:17
Show Gist options
  • Save seferciogluecce/a99eb9efa2c31a576a6537000d4da8c8 to your computer and use it in GitHub Desktop.
Save seferciogluecce/a99eb9efa2c31a576a6537000d4da8c8 to your computer and use it in GitHub Desktop.
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(Collider))]
public class Stick : MonoBehaviour
{
public string StuckObjectTag = "Wall";
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag(StuckObjectTag))
{
GetComponent<Rigidbody>().isKinematic = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment