Download

Distance between bones via Blueprints?

Hello,

I’m doing some testing in UE4 and I need to check the distance between two bones, then have a log message that tells me what is the distance between the during runtime ( since the bones are animated ).

It is possible to look for exactly a bone name and setup this blueprint?

Alternatively, if the bone name could not be looked for, it is possible to “constraint” a dummy mesh to that bone and then use that dummy mesh in order to check the distance between them?

Cheers

Nicolas

Hey Nicolas,

The function used to get a bone is a little unfortunately named (maybe we can improve this in future). It’s called “get socket …”

You can use this to get (as the name suggests) a socket transform, but also a bone!

I’ve attached a picture of the 2 ways you can do this: either directly with a “get socket location”, or using a “get socket transform”, which gives you more flexibility about what transform space the values are returned in (ie. is it relative to the world origin, the actor location or the mesh component)

good luck,

-nick

This is exactly what I was looking for! Great!

Sorry to bother you again with a question, but is there a possibility to get the distance between the two sockets and show the value ( in runtime ) in the viewport?

That would be super great :slight_smile:

Anyway thanks again for the answer

We’re starting to wander out of Unreal territory and into general vector math land!

Subtract one location (vector) from the other, then get the length of the resulting vector to give you the distance in unreal units (cm).
VectorLength.JPG

If you need to brush up on your vector math, I’d suggest maybe checking out Khan Academy- some great free learning tools:
http://www.khanacademy.org/math/linear-algebra/vectors_and_spaces/vectors/v/linear-algebra--vector-examples#!

Take a look at the blueprint Pallete to see the kinds of things you can do with vectors and that might give you a good head start. If you don’t understand some of the terms, Khan or google can be very helpful! :smiley:
VectorMathFunctions.JPG

Nice!

Thanks again :slight_smile: