I'm trying to get an object/projectile to stick to a tree, I've looked up other answers and have tried to implement, still don't understand why it's not working.
-Rigidbody on Axe object.
-Rigidbody and Box Collider Trigger on tip of axe edge in an empty child object of the Axe object.
-Script attached to child object with Trigger.
-Tags are all appropriately set.
-The objects make physical contact, it just doesn't stick when the trigger hits or even Debug.Log.
public void OnTriggerEnter(Collider other)
{
if (other.tag == "Climbable")
{
Debug.Log("grappled");
Rigidbody pb = this.GetComponent();
Rigidbody r = axe.GetComponent();
//Collider x = axe.GetComponent();
r.isKinematic = true;
pb.isKinematic = true;
// pb.velocity = Vector3.zero;
axe.transform.parent = other.transform;
}
}
↧