I use models designed in Blender, and I need to add attachment points to it for special effects. Like mark a point in a hand of a model (modified by hand animations of course) that I can apply glow to when needed. I know how to apply glow to a 3d point, I just need a way to get that point.
How do I do t开发者_开发百科hat?
There's a couple ways to do this sort of thing, but I like this approach the best because it's easy for tech artists to interface with it (alls it needs is a special name on an object). You can have your top level character script scan its children and look for objects with some naming convention you specify.
foreach(Transform child in gameObject.GetComponentsInChildren<Transform>()) {
if( child.name == "AttachmentPointOrWhatever" ) {
myEffectsObject.transform.parent = child;
myEffectsObject.transform.localPosition = Vector3.zero;
}
}
This works because Unity will update the bones' positions based on your imported animation, so the effects object would follow along with the point that you imported with your animation.
As far as creating the animation, I'm coming from Maya and 3ds Max, but the idea should be the same for blender: Add extra bones for your attachment points and make sure they're bound to your model (or added to the skin weights or whatever the term is in Blender). They shouldn't have any weights on any vertices, but they need to be in the bind set so that Unity recognizes them as part of your animation and properly animates the points.
精彩评论