- Home /
How do I make an object stick to all other objects (2D)
How would I go about creating a script which would allow, for example, an arrow to pierce any other gameobject, like an enemy, the walls or the floor, and stick to it? I would like it if that gameobject moved, the arrows would move with it. I've tried attaching OnCollisionEnter() function to my arrow script, however nothing ever happened, even my Debug.Log messages didn't trigger once.
Answer by YoungDeveloper · Aug 21, 2015 at 03:42 PM
You could simply parent the arrow or any object to the object it hit.
Answer by CaKeMeaT · Aug 21, 2015 at 11:44 PM
You may want to pay special attention to triggers vs colliders and OnCollisionEnter vs OnTriggerEnter
Your answer
Follow this Question
Related Questions
Cannot get collision to do anything 1 Answer
Sprite collision with Tilemap 2 Answers
How to make kinematic rigidbody react to some collisions 6 Answers
OnCollisionEnter function problem. JS 2 Answers