In my game, I need to attach an actor to the bone of a skeletal mesh. Depending on the situations, the bone I attach the actor to is placed differently, depending on the section I wish to play in the montage.
I would like, before I play the montage, to know what will be the position of the bone in world space, so I can make the attached actor move toward the correct location.
I tried to use MeshComponent->GetBoneLocation() but it returns the current location, not the location of the first frame (even when I call this function just after Montage_Play on the animinstance. I guess the location is updated in the next frame)
I think the functions you gave to me do the same thing
Ok i need to be cerful now so i don`t give you the wrong information .
But am 99% sure that this should return the location of the socket.
I will be off work in 2 houers if no smart minds been before that i will post a snip of my code.
That is use to snap weapons to the correct socket location of a player.
Now I need to convert this in world space. But the problem is that the FTransform I get this way is relative to the parent of the bone. So I need to figure out how to get the correct transforms…
This returns all transform of bone data in their parent space and there you can calculate exact bone you’d like. You also have to multiply ComponenToWorld to get worldspace since that will be still component space.
If you’re only wondering about root motion, you can use this function. That function also can be used to
>>In my game, I need to attach an actor to the bone of a skeletal mesh. Depending on the situations, the bone I attach the actor to is placed differently, depending on the section I wish to play in the montage.
Generally this isn’t the way we do. Since you never would like player to teleport, we give time to blend to the target location. We use target bone and while playing we makes player to interpolate to the target location.
Or you can use some prep animation that has correct bone transform to move to the location and when that’s done, you can transition to the animation that has to be in that position.
I was able to achieve my need with the function : UAnimSequence::GetBoneTransform, which I call recursively from the bone up to the root bone. Then I multiply the transform by the ComponentToWorld. I know for sure there will be no root motion or animation retargeting on the assets, as it is not a player, but a basket ball hoop.
There is no teleport in what I do: the attached actor is a basket ball, which I attach to a dedicated bone on a basket skeletal mesh. I have animations for succeeded and failed shots. Depending on the animations, the starting point of the bone of the ball is not located at the same place (around the rim, or on the board).
When a player shoots the ball, I compute the trajectory of the ball using ballistics equations. That’s why I want to have the location of the ball bone before I play the animation, because I use this location as the destination point of the trajectory.
When the trajectory ends, I know the ball is at the correct position, and only then I attach the ball to the ball bone of the hoop, and play the montage, with the blending doing its job of interpolating the ball nicely.
hi all! maybe get bone location could help my problem , anyways is about metahuman , last step face post animation blueprint , theres only a pose connected to control rig … ok whatever try offset joints before this is useless , joints are blocked , after control rig can apply transform bone and can move freely the joints like i want ear more far from face… but one by one and not precise , i did some animation in maya to move the joints to some place i want , i try plug apply additve between control rig and new animation , i want control rig joints to offset move to some other joints pose i give thru animation but gets deformed , any way to make this additive joints animation works? the things seems have to be after all this contrl rig , if try add it in the sequencer or whatever is useless…
I updated the function to use the reference skeleton from the skeleton instead of the preview mesh to be able to use this function inside a packaged build
The result transform is in bone space so if you want the world space you can compose (A*B) the resulting transform (A) by the mesh world transform (B).