Hello guys,
I have been breaking my head for a while and I decided to ask here after all. In my game the player shot an arrow to a fish and I want the arrow to make the fish it child but keep the arrow at the point where it hit the fish before it made it its child. I have look all over the web and found no solution so I am counting on someone here who can shine some light on this. How to do it.
Situation detailed:
void OnCollisionEnter(Collision collision) {if(collision.gameObject.CompareTag(“Headshot”))
{
fish = collision.transform.root.GetComponent();
fish.transform.parent = arrowTransform;//By now the arrow is at the origen of the gameObject instead of the point it hit it!
}
}
player shot the arrow. Arrow hit fish(say by the head) on collision enter I get the point where it hit the fish. Now based on the logic of the game the fish has to become the child of the arrow in order for me to manipulate the fish through the arrow. The problem, because this is happening fast by the time I parent the fish to the arrow the arrow is at the origin of the fish and not by the head.
So I thought, there has to be a way to move the fish after parented to the arrow so it matches the point where the fish was hit. but nothing work for me so far in this regard.
Any help is very much appreciate it. I code in C#.
Regards,
Carlos