• News

• Industries

• Learning & Support

• Community

• Marketplace

# Attaching objects to morph targets

We are trying to find a way to allow an item attached to a static mesh with a morph target to dynamically change its position with the morph adjustments. We’ve explored the possibility of using sockets to do the attachment but that’s not working as hoped. Replacing the mesh with a version having the attached object is not even close to a reasonable solution (we are talking attaching guns, knives, etc. to our actor here). So far the sockets only move in relation to the parent’s position and not in relation to the changes to the morph. Think of a gun on someone’s shoulder that is deformable. Our test litterally had a small sphere above the shoulder which got swallowed up with the actions of the shoulder deformer (that was a socket attached to the bone but the static mesh socket didn’t do any better).
Has anyone encountered this problem before? Is there a better solution? The deformers are a must as is the ability to attach object to the surface that react properly to the deformation.

Sounds interesting… Is this for character customization or for corrective mesh deformation?
Im not proficient in c++ but I imagine you could build a matrix based on 3 vertices of the mesh that you can drive an actual socket bone from. It might be more performance consuming than cheaper solutions like baked socket bones but its flexible for random ingame motions.
So what you would do is get the vertex you want to drive a socket from. Then get 2 surrounding vertices so that the edges between them form an L shape. The vert in the middle is the main one. Then you get the vector for mid-up and mid-side, you also get the normal vector for the mid vert and the position. From those four vectors you can then construct a matrix and drive the socket bone somehow. This is all just theory in my head, I wouldnt know how to make this happen and im almost sure youll need some c++ for that.

A simpler solution would be to simply have an animated bone that has the exact same movements as the morphs. Then you just blend those animations on it based on the morph target values.

That would mean creating an entire custom bone structure I suspect. That’s several hundred custom bone elements. :eek:

no, only a custom node that can generate a set of rotation and translation values based on an input mesh object vertex list.
That then drives the socket bone you have (or will have) set up.

By the way this is for character customization. I forgot to answer your question. The static mesh for actor has already been created (and paid for!) and we are using standard bone structure for library compatibility. And this is for a MMORPG… performance is a BIG issue when you have a character base numbering in the thousands of actors.

Hey, Ave did you find a solution? I kinda need that. Thinking of just having several sockets switching between them when a certain number for a morph exceeds a certain amount myself.

So, why not drive the socket or attached item location with the same morph curve?
The curve describes “something” that morphs. you need the socket to morph according to this “something”.

You can get the curve in anim_bp and modify either the attached item or the socket itself…

Example:
Let’s assume the curve of the morph is described from 0 to 1.
Let’s assume i’m only shifting the forward direction, as it’s easier to imagine (the character got fat, and the belt buckle has to move forward).
by testing I define that my curve 1 needs to be 400, but 0 is fine as the starting point. (i’m adding in local space to the socket).
Current curve value * 400 = where whatever needs to be.
So if my character is only half as fat, I can expect my belt buckle to be at 200 units forward. .5 curve * 400 = 200

Driving 2 parameters gets harder, but that would be the gist of how to do it easily and accurately.