Hello, I’m trying to make an archer controller but I couldn’t make it really.While Draw Arrow animation is playing I make arrow a child of right hand as in image.I modify local position and local rotation a little to make it look more natural.I’ve included code here.
arrow.transform.parent=main_hand;
arrow.transform.localPosition=new Vector3(.45f,-.1f,0);
arrow.transform.localRotation=rot;//rot is 8,90,90
Now evertyhing goes well until the shooting moment like in second image.When shoot command is given I set the arrow’s parent to null and send it forward.But when parent is set to null arrow always change position randomly.
I know it sounds stupid but I couldn’t make it’s parent null and keep it’s position same in world space at the same time.These are the codes I’ve tried.
arrow.transform.parent=null;
//arrow.transform.SetParent(null,false);
//arrow.transform.SetParent(null,true);
I think problem might be about scale or multiple parent(look hierarchy).How can I make it keep it’s world position while setting it’s parent to null.Thanks.