I’m trying to make it so that when my arrow gameobject collides with something - it stops moving (so it looks like it’s sticking out from the ground, wall, or any enemy).
Right now it stops velocity, but unless I shoot it down it just rotates in place without moving.
Would anyone be able to help me?
Here’s my collision function on my arrows:
void OnCollisionEnter2D(Collision2D coll) {
fired = false;
GetComponent<Rigidbody2D> ().velocity = new Vector2(0,0);
GetComponent<Rigidbody2D>().isKinematic = true;
GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY;
}
Also, should I attach the arrow as a child to whatever it hits? Would that make it move with whatever it hits? Thanks in advance!