Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-11-19 09:21:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-19 09:21:39 +0300
commit18200f5f8711e630adb729b8bffffb5893fd0c02 (patch)
tree97d6716627303be2819d11d18ed183f7d64da484 /source/blender/blenkernel/intern/constraint.c
parent844e63f3b60a5a07af8a6454dec3c6b4939ae886 (diff)
bugfix for pivot constraint.
- no rotation resulted in NAN location. - subtraction of pivot done in wrong order made the constraint give odd results when rotating on more then 1 axis.
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 5dff21d8af4..076dae41e6a 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3814,7 +3814,6 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
/* pivot correction */
float axis[3], angle;
- float dvec[3];
/* firstly, check if pivoting should take place based on the current rotation */
if (data->rotAxis != PIVOTCON_AXIS_NONE) {
@@ -3861,14 +3860,16 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldnt */
mat3_to_axis_angle(axis, &angle, rotMat);
- sub_v3_v3v3(vec, pivot, cob->matrix[3]);
- project_v3_v3v3(dvec, vec, axis);
- sub_v3_v3(pivot, dvec);
-
+ if(angle) {
+ float dvec[3];
+ sub_v3_v3v3(vec, pivot, cob->matrix[3]);
+ project_v3_v3v3(dvec, vec, axis);
+ sub_v3_v3(pivot, dvec);
+ }
/* perform the pivoting... */
/* 1. take the vector from owner to the pivot */
- sub_v3_v3v3(vec, pivot, cob->matrix[3]);
+ sub_v3_v3v3(vec, cob->matrix[3], pivot);
/* 2. rotate this vector by the rotation of the object... */
mul_m3_v3(rotMat, vec);
/* 3. make the rotation in terms of the pivot now */