- Home /
Making an object from scene a parent of a instantiated prefab
Hello Folks I an making an game in which there is a skeleton character which has moments, and a series of instantiated birds which instantiates in certain time intervals. Now what I need is that the bird would come towards the charterer and pinch away a bone from the character.
I have already created the Bones' flying away animation (in maya and imported it with character as well) which plays each time birds collides with the character . I am using 'moveTowards' to move the bird towards the charterer.And that is working fine.
My question is is there any way that i can make the instantiated bird child of those little bones which move away during there animation ?
P.S. the bones which are being animated are already child of certain other big bones.
Thanx in advance.
Answer by kurotatsu · Jun 24, 2012 at 04:52 PM
I would make the bone a parent to the bird model, then disable the birds mesh renderer in the inspector making him there, but invisible at during gameplay. then when your animation is called in a script have it send a message to your bird model to enable it's meshrender component.
Things to look into if you don't know about them already:
var bird = GameObject;
bird.GetComponent ("skinnedMeshRenderer").enabled = false;//My spelling may be off for the renderer
bird.enabled = false;
bird.gameObject.active = true;
bird.gameObject.SendMessage("cansee",SendMessageOptions.DontRequireReceiver);
Hope this points you in a direction that'll help.
Your answer
Follow this Question
Related Questions
Why is parenting not working? 0 Answers
Instatiate as a child of a GameObject 1 Answer
Is Physics.SyncTransforms() automatically called in built game? 0 Answers
Box collider 2D turn invisible when assigned as child. Why ? 1 Answer
finding an object with tag, out of a few objects that are in array 1 Answer