Skeletal Controls with C++

Hi, i’m following Rama’s tutorials to try to control single bone rotation in my actor [here][1]

This led me to the following animation blueprint:

SkelControlCraneArmPitch is set in C++ code inside my actor class:

51650-code_img.jpg

The relevant part is inside the “IsArmRotating” conditional. Basically i check for input which sets the flag as true and depending on the key sets “ArmDirection” as either 1 or -1.

The controls work, however i’m having two problems:

  • Even though i’m modifying Pitch, the bone appears to Roll instead. This is very weird because in blueprint preview modifying pitch works fine and in the game it doesn’t.

Changing pitch in blueprint preview:

Changing pitch inside the game:

51662-ingame.jpg

  • Moving the actor results in the bone getting “locked” in the initial rotation:

51663-ingame_2.jpg

If anybody has any tips on how to solve and/or understand these two issues i’ll be extremely grateful.

Thanks!

Alright, i managed to solve both problems, though i only know what solved the “locked rotation” one:

I had to add the current mesh rotation to the bone rotation as well. This was a no-brainer actually and i feel a little ashamed not to realize this before posting the question. Here’s the new Tick implementation:

51685-code_img_2.jpg

As for the weird Pitch behavior, i don’t know how but it started working fine out of the blue, even before implementing the fix above. I did close and reopen the editor, but that shouldn’t have any impact in a thing like this right?

I’m not closing it yet because i still want to know why such weird behavior with the Pitch happened. Does anyone know if this is a bug?