hey, how do i detach a child and add a reletive force at the same time from a script on the parent?
plz JAVA :P
hey, how do i detach a child and add a reletive force at the same time from a script on the parent?
plz JAVA :P
It's actually Java, not JAVA, and it's actually JavaScript, not Java. (And technically, it's actually UnityScript, not 'real' JavaScript ;)
The language thing might not seem important, but there's enough confusion about languages flying around as is, so I generally try to provide clarification when it seems appropriate.
Although I'd have to check to be sure, I think to detach a child you can simply write:
child.transform.parent = null;
Assuming 'child' references a child game object.
If you want to apply an 'all at once' force at the moment the object is detached, you'll probably want to use the 'impulse' force mode, e.g.:
child.rigidbody.AddRelativeForce(force, ForceMode.Impulse);