have a single bone follow the player character

Hi guys, i am searching for a way to have a statues head follow the player movement. i searched for a solution but havnt really found one.
i am very new to this, but i guess i will have to set up a simple rig for this in 3dsmax and import it to fbx.
i would only create one bone for the statue body and one bone for the head.
is it possible to adress the head bone via blueprint and have it orient towards the active player.
best would be to have a degree range for this to limit the movement of the head otherwise it would look to silly if the statue has its head bend 180 ° to the back :wink:
any hints are very welcome !!

kind regards
stucki

Yes it’s possible. You need two things: an Animation BP where you can control behavior of the bone and regular BP that will control when AnimBP should run it’s code.
Check this tutorial to get a glipse of how it works.
https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1ga0IoRrpI4xkX4qmCrhGu56/gwD66cYmwQE/

In BP you can check if player is at some desired distance from the statue, or if he is directly visible, or any other condition you are interested it. Then you can pass this condition as a variable to Animation BP, perhaps with a reference to the player that statue needs to follow, or just direction vector it should look at. Passed variables then used in AnimBP to turn the bone. Basically it’s like you have two separate BPs that talk to each other but do different parts of the work.

thx for the answer. this helps a lot.
Maybe you could add some info how to adress the bone and set its direction vector so it points to the player character (there is only one) :wink:
kind regards
stucki

I think there was LookAt() function in AnimBP, but it works only for looking at bones of the same skeleton (might have changed). Otherwise you can calculate LookAt rotation in BP and pass it to AnimBP as variable. Check this tutorial, I think it does something that you need:

thx again. this looks very much as i was looking for !!!

so here i am back again with some more questions …
in the last example you linked they controlled the head rotaion of an ai character… my needs are much simpler… so maybe there is a more simple solution for me, too :wink:

i dont have walking characters right now that have to be controlled.
its only non moving objects (a statue) with a few bones in it, and i only need to control the rotation of one bone.

so i managed to skin a demo object in 3dsmax with 3 bones in it. i exported an animated sequence of it (100 frames) as fbx and voila i managed to import it to ue 4.18.

i now have 4 objects:
a skeletal mesh : PFERD_ANIMATION_01
a animation sequence : PFERD_ANIMATION_01_Anim
a physics asset : PFERD_ANIMATION_01_PhysicsAsset ( i guess i do not need this at all …)
and a skeleton: PFERD_ANIMATION_01_Skeleton.

if i insert the skeletal mesh into my scene and set animation mode to use animation asset and insert my animation sequence
i see my objects with the animation playing if i play / simulate my scene.

now i only need to adress the bone (called “head_bone”) from the level blueprint and set its rotation to the direction of the player.
but i cant find any solution to this …
i added a socket to my bone and can print out the rotation of it, but i cant see any solution on changing the rotation of the bone …

Does somebody have any advice / hint for me how to acces the bone itself and change its rotation via level blueprint ?

kind regards
stucki

That’s helpful but unfortunately you didn’t write the name of the docs page that you linked to and now we are being redirected to the documentation homepage. Its common for lazy documentation writers to constantly break links.
Detailed info on pages should always be included with links so people can use a search engine to find what’s been moved. Now your most appreciated efforts will stay relevant for many years regardless of the mistakes people make at the other end of provided links.