Question by
Jaimieself · Mar 13, 2018 at 02:00 PM ·
scaleprojectileparentingchild objectparent transform
Get arrows to stick into things that move.
I have a nice little bow and arrow system that sticks into things.
But when i shoot an object that moves the arrow stays put, but the movable object moves, leaving the arrow behind.
I would like to make the arrow a child of the object it hits, but i suspect there will be a scaling issue.
So problem 1: Get arrow to stick into something and move with it. and problem 2: Get it to keep its own scale.
I have done a tutorial on YT but it was 6 years old and doesn't seem to work.
Any Ideas?
Oh and this is code so far:
public Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody> ();
}
void OnCollisionEnter()
{
rb.velocity = new Vector3(0, 0, 0);
//make child of other object
Destroy(GetComponent<Rigidbody>());
}
}
Comment