I’m importing some custom models into Urho3D using a custom Model
implementation (which extends Model
and overrides serializing the data from a custom format) and passing this to the standard AnimatedModel
class. If I don’t applying a Skeleton
to the custom Model
, the model is then rendered as I would expect. But as soon as I apply the model’s skeleton, it is no longer rendered or at least visible.
I’m setting the skeleton which consists of 26 bones in total as follows:
Urho3D::Skeleton skeleton;
auto &bones = skeleton.GetModifiableBones();
for (unsigned i = 0u; i < modelFile->GetBones().Size(); ++i)
{
const auto &modelBone = modelFile->GetBoneByIndex(i);
Urho3D::Bone bone;
bone.name_ = Urho3D::ToString("%u", modelBone.boneId);
bone.nameHash_ = bone.name_;
bone.initialPosition_ = modelBone.pivot.ToUrho3D();
// we do not define the following in our bone definitions
// additionally, bounding box, offset matrix, and radius aren't in the data
bone.initialRotation_ = Urho3D::Quaternion::IDENTITY;
bone.initialScale_ = Urho3D::Vector3::ONE;
bone.parentIndex_ = (modelBone.parentBone == -1 ? i : modelBone.parentBone);
bones.Push(bone);
if (bone.parentIndex_ == i)
skeleton.SetRootBoneIndex(i);
}
// Set the skeleton on the Model
SetSkeleton( skeleton );
I wouldn’t expect that an AnimationTrack
needs to be bound to the model because if I disable applying that to the model in the SkeletalAnimation example, the model renders with the skeleton & the base model pose just fine.
Is there potentially something else I need to be setting properly for this to work?