From b1c9fb99e363fcba0e96b82dd43b76538efea065 Mon Sep 17 00:00:00 2001 From: lvlong Date: Sat, 16 Aug 2014 19:51:59 +0800 Subject: [PATCH] animation is ok. --- cocos/3d/CCBundle3D.cpp | 6 +++--- cocos/3d/CCSkeleton3D.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index 2d2a8d101c..1899935436 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -1292,7 +1292,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue) for (rapidjson::SizeType j = 0; j < bones.Size(); j++) { - const rapidjson::Value& bone = bones[i]; + const rapidjson::Value& bone = bones[j]; // node if (!bone.HasMember(NODE)) @@ -1306,9 +1306,9 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue) Mat4 invbindpos; const rapidjson::Value& jtransform = bone[TRANSFORM]; - for (rapidjson::SizeType j = 0; j < jtransform.Size(); j++) + for (rapidjson::SizeType k = 0; k < jtransform.Size(); k++) { - invbindpos.m[j] = jtransform[j].GetDouble(); + invbindpos.m[k] = jtransform[k].GetDouble(); } //invbindpos.inverse(); diff --git a/cocos/3d/CCSkeleton3D.cpp b/cocos/3d/CCSkeleton3D.cpp index 23939345d2..6b5b20a77d 100644 --- a/cocos/3d/CCSkeleton3D.cpp +++ b/cocos/3d/CCSkeleton3D.cpp @@ -299,6 +299,7 @@ Skeleton3D* Skeleton3D::create(const std::vector& skeletondata) auto skeleton = new Skeleton3D(); for (const auto& it : skeletondata) { auto bone = skeleton->createBone3D(*it); + bone->resetPose(); skeleton->_rootBones.pushBack(bone); } skeleton->autorelease();