这两段伪代码有何不同之处?
// Multiplying a matrix by the difference between each frame
float difference = current - previous; // Time since previous frame
float angle = difference / 500;
matrix rotation;
rotation.RotateX(angle);
rotation.RotateY(angle);
worldMatrix *= rotation; // Note multiply
// Multiplying a matrix by the difference between current and start
float difference = current - start; // Time since first frame
float angle = difference / 500;
matrix rotation;
rotation.RotateX(angle);
rotation.RotateY(angle);
worldMatrix = rotation; // Note assignment
每段代码之间只有非常微小的差异,但会导致视觉上的巨大差异。输入看起来像这样:
帧1:旋转= 1弧度
worldMatrix *= rotation;
帧2:旋转= 1弧度
worldMatrix *= rotation;
等等...帧1:旋转= 1弧度
worldMatrix = rotation;
帧2:旋转= 2弧度
worldMatrix = rotation;
等等...