This adds support for skeletal animation using SCNSkinner and CAKeyframeAnimation. The following are the high level steps:
Step 1:
The importer builds a list of unique bones, the bone nodes and the bone inverse bind transforms. Then it works out the skeleton node by picking the depth of each unique bone from the root. If there are more than 1 bones at the same minimum depth, it picks the parent as the skeleton node.
Step 2
The bone and vertex weight data provided by assimp is parsed into a list of bone weights and bone indices which map into the list of unique bones prepared in the earlier step.
Step 3
The animation data is then parsed to prepare a list of CAKeyframeAnimation for each channel of the animation, which maps to a deform bone. The position, rotation and scale keys are mapped to position, orientation and scale key paths for each bone node. Each keyframe animation duration is aiAnimation->mDuration / mTicksPerSecond if mTicksPerSecond != 0, otherwise it is just mDuration.
This adds support for skeletal animation using
SCNSkinner
andCAKeyframeAnimation
. The following are the high level steps:Step 1:
The importer builds a list of unique bones, the bone nodes and the bone inverse bind transforms. Then it works out the skeleton node by picking the depth of each unique bone from the root. If there are more than 1 bones at the same minimum depth, it picks the parent as the skeleton node.
Step 2
The bone and vertex weight data provided by
assimp
is parsed into a list of bone weights and bone indices which map into the list of unique bones prepared in the earlier step.Step 3
The animation data is then parsed to prepare a list of
CAKeyframeAnimation
for each channel of the animation, which maps to a deform bone. The position, rotation and scale keys are mapped to position, orientation and scale key paths for each bone node. Each keyframe animation duration isaiAnimation->mDuration / mTicksPerSecond
if mTicksPerSecond != 0, otherwise it is justmDuration
.