Please help me to understand, how to append decales (marks of blows of the sword or marks of bullets) to animated objects.
I thought that it should be gameobject, which i appending to collision gameobject (in contact.point), but in this case decale object not animated. It works only if i append it to “bone”, but for me it looks strange, i think it’s not good.
May be it should be texture decales? In this case could me help somebody (How to) ?
Why? The bone is the source of motion in animation and attaching objects including decals is completely normal. Internally, whole character model is attached to the bones and if you want something to move with model it is pretty obvious to attach it to the appopriate bone. Also many games are using models with special invisible bones for attaching things. This is widely spread technique.
If you want texture decal, you’d better not use SetPixel/GetPixel. You need to write a shader what accepts additional texture atlas with decals and vector4 array, where (x,y,z) is desired texture coordinate for decal and w is decal id, from wich you may calculate uvs for decal. After that, you just return (texture_color + decal_color) for pixel and that’s it. Try multiplication or other operations. Also you may want to ajust alpha if using transparency.
But how i can correct attach to Bone? Please check my screen. I have collision on gameobject ShieldID2, but i don’t know for which bone it attached. It works for me when i attach decale for bone B_L_Forearm. But how i should understand for which bone i should attach decale?
So after battle i will have many decales in “Motion” object? Why shield not in Motion hierarchy? Sorry, i don’t understand how i should do properly
By the bone name and place in hierarchy. If you want your character shield in left hand, find left palm or left forearm bone and add that shield as a child object to it. When scripting on this, remember what animation update bones positions inbetween Update and LateUpdate callbacks.