Browse Source

Merge pull request #51991 from requizm/fix/51990

Fix 3d animations doesn't play
K. S. Ernest (iFire) Lee 4 years ago
parent
commit
bb1c930a41
1 changed files with 4 additions and 2 deletions
  1. 4 2
      scene/resources/animation.cpp

+ 4 - 2
scene/resources/animation.cpp

@@ -83,9 +83,11 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
 
 
 				const real_t *r = values.ptr();
 				const real_t *r = values.ptr();
 
 
-				tt->transforms.resize(vcount / 12);
+				int transform3d_size = (int)sizeof(Transform3D);
 
 
-				for (int i = 0; i < (vcount / 12); i++) {
+				tt->transforms.resize(vcount / transform3d_size);
+
+				for (int i = 0; i < (vcount / transform3d_size); i++) {
 					TKey<TransformKey> &tk = tt->transforms.write[i];
 					TKey<TransformKey> &tk = tt->transforms.write[i];
 					const real_t *ofs = &r[i * 12];
 					const real_t *ofs = &r[i * 12];
 					tk.time = ofs[0];
 					tk.time = ofs[0];