Last active
August 8, 2020 06:17
-
-
Save seferciogluecce/a99eb9efa2c31a576a6537000d4da8c8 to your computer and use it in GitHub Desktop.
Tutorial: https://youtu.be/R5XIncKWL28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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