By now only moves forward but am planning to implement all directions.
Am using the OnAnimationEnd callback to return to the Idle position, but since my char is moving forward I want it to really change its position.
Now its only jumping back to the initial position.
Code: Select all
void EventReceiver::OnAnimationEnd(irr::scene::IAnimatedMeshSceneNode* pAnimNode)
{
pAnimNode->setTransitionTime(0.2f);
pAnimNode->setFrameLoop(0, 24);
pAnimNode->setLoopMode(true);
pAnimNode->setAnimationSpeed(30);
pAnimNode->setAnimationEndCallback(0);
}
- I tried getting the root joint (one at the top hierarchy of the bones in the skeleton) while the callback is executed, then I get its absolute position and add it to the current position of the animNode (only for one of the axis), this doesn't work, am still getting a twitch, because the locations doesn't match perfectly
Another option; keep adding the direction with the key event pressed ASWD. Couldn't make it look good, tweaking the offset value to match the animation timing seems too hacky, but perhaps am missing a very basic foundation?