Ok so i have a gun model parented to the hand of my AI so i was able to get the gun to unparent from the hand of the AI when the AI is killed but to get the gun to fall i added both a mesh collider and rigidbody to the model so when i started having weird issues or example the gun starts floating outside the hand of the AI or if i check IsKinematic on the rigidbody when the AI dies it doesn't fall it just gets stuck in the air, i also tired unchecking IsKinematic and freezing the position and rotation but that doesn't work either. So i'm curious to know if there's a fix for this. Thanks Code (CSharp): public GameObject Gun; void OnAIDeath() { Gun.transform.SetParent(null); } That's some part of the code i used
just a guess, maybe rigidbody is sleeping, https://docs.unity3d.com/ScriptReference/Rigidbody.WakeUp.html
i'd try setting parent this way also, Gun.transform.parent = null; and check in hierarchy that it actually works (unparents it) need to disable [ ] isKinematic, and disable those freeze positions too, it seems you tried that.
The thing is if I disable isKinematic the Gun starts to move on its own and doesn't aim properly at all
Ok i finally got it to work there were two things i did 1.) I moved the script to the parent model(yes i know i feel like a moron now) 2.) I did something like this i first made isKinematic true and then i added the following lines of code Code (CSharp): public Gameobject Gun; public Rigidbody rig; void OnAIDeath() { Gun.transform.parent = null; rig.isKinematic = false; }