forked from bartvdbraak/blender
Patch provided by Stephan Kassemeyer.
This fixes an error in the striding system, which was by default correcting path position backwards in time, which could give errors when a stride bone moves in the beginning of a path faster than the path moves. (Can you follow that? cool!) The patch checks for this case, it corrects by default forwards in time, unless we're at the end of a path. As bonus this fix will also ensure the character stays on the path closer.
This commit is contained in:
parent
77332fa698
commit
b310216a47
@ -754,7 +754,7 @@ static float stridechannel_frame(Object *ob, bActionStrip *strip, Path *path, fl
|
||||
|
||||
if(foundvert && miny!=maxy) {
|
||||
float stridelen= fabs(maxy-miny), striptime;
|
||||
float actiondist, pdist;
|
||||
float actiondist, pdist, pdistNewNormalized;
|
||||
float vec1[4], vec2[4], dir[3];
|
||||
|
||||
/* amount path moves object */
|
||||
@ -764,12 +764,21 @@ static float stridechannel_frame(Object *ob, bActionStrip *strip, Path *path, fl
|
||||
/* amount stride bone moves */
|
||||
actiondist= eval_icu(icu, minx + striptime*(maxx-minx)) - miny;
|
||||
|
||||
pdist = pdist - fabs(actiondist);
|
||||
pdist = fabs(actiondist) - pdist;
|
||||
pdistNewNormalized = (pathdist+pdist)/path->totdist;
|
||||
|
||||
/* now we need to go pdist further (or less) on cu path */
|
||||
where_on_path(ob, (pathdist)/path->totdist, vec1, dir); /* vec needs size 4 */
|
||||
where_on_path(ob, (pathdist+pdist)/path->totdist, vec2, dir); /* vec needs size 4 */
|
||||
VecSubf(stride_offset, vec1, vec2);
|
||||
if (pdistNewNormalized <= 1) {
|
||||
// search for correction in positive path-direction
|
||||
where_on_path(ob, pdistNewNormalized, vec2, dir); /* vec needs size 4 */
|
||||
VecSubf(stride_offset, vec2, vec1);
|
||||
}
|
||||
else {
|
||||
// we reached the end of the path, search backwards instead
|
||||
where_on_path(ob, (pathdist-pdist)/path->totdist, vec2, dir); /* vec needs size 4 */
|
||||
VecSubf(stride_offset, vec1, vec2);
|
||||
}
|
||||
Mat4Mul3Vecfl(ob->obmat, stride_offset);
|
||||
return striptime;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user