hey guys! if you want take a look on that expression i wrote. it works and that's all i wanted. but there a some problematic cases.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
float $xAct; // the actual x-Value alias x2
float $zAct; // the actual z-Value alias z2
float $xPrev; // the preverious x-Value alias z1
float $zPrev; // the preverious z-Value alias z2
float $xDif; // Difference x1-x2
float $zDif; // Difference z1-z2
float $modYRot=control.rotateY; //modulo-value of the y-rotation-control-locator (wheel is attached to that)
float $xzDistance; //pythagoras for distance
float $WheelRadius = 1; // wheel-radius
int $reverse; //flag for rotation-direction 0 meens forward; 1 meens backwards
$xPrev = $xAct;$zPrev = $zAct;
$xAct = control.translateX;$zAct = control.translateZ;
$xDif = $xAct - $xPrev;$zDif = $zAct - $zPrev;
if($modYRot > 360){
while($modYRot>360){
$modYRot=$modYRot-360;
}
}
if($modYRot < -360){
while($modYRot < -360){
$modYRot=$modYRot+360;
}
}
if($modYRot == 0 || $modYRot == 360 || -360){
if($zPrev < $zAct){
$reverse = 0;
}
if($zPrev > $zAct){
$reverse = 1;
}
}
if(($modYRot > 0 && $modYRot < 90) || ($modYRot > -360 && $modYRot < -270)){
if($xPrev < $xAct && $zPrev < $zAct){
$reverse = 0;
}
if($xPrev > $xAct && $zPrev > $zAct){
$reverse = 1;
}
}
if($modYRot == 90 || $modYRot == -270){
if($xPrev < $xAct){
$reverse = 0;
}
if($xPrev > $xAct){
$reverse = 1;
}
}
if(($modYRot > 90 && $modYRot < 180) || ($modYRot > -270 && $modYRot < -180)){
if($xPrev < $xAct && $zPrev > $zAct){
$reverse = 0;
}
if($xPrev > $xAct && $zPrev < $zAct){
$reverse = 1;
}
}
if($modYRot == 180 || $modYRot == -180){
if($zPrev > $zAct){
$reverse = 0;
}
if($zPrev < $zAct){
$reverse = 1;
}
}
if(($modYRot > 180 && $modYRot < 270) || ($modYRot > -180 && $modYRot < -90)){
if($xPrev > $xAct && $zPrev > $zAct){
$reverse = 0;
}
if($xPrev < $xAct && $zPrev < $zAct){
$reverse = 1;
}
}
if($modYRot == 270 || $modYRot == -90){
if($xPrev > $xAct){
$reverse = 0;
}
if($xPrev < $xAct){
$reverse = 1;
}
}
if(($modYRot > 270 && $modYRot < 360) || ($modYRot > -90 && $modYRot < 0)){
if($xPrev > $xAct && $zPrev < $zAct){
$reverse = 0;
}
if($xPrev < $xAct && $zPrev > $zAct){
$reverse = 1;
}
}
$xzDistance = sqrt(($xDif)($xDif) + ($zDif)($zDif));
if ($reverse == 0){
wheel.rotateX = wheel.rotateX + $xzDistance*360/(2*3.1417*$WheelRadius);
}
if ($reverse == 1){
wheel.rotateX = wheel.rotateX - $xzDistance*360/(2*3.1417*$WheelRadius);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
http://www.frank-spalteholz.de/cinema/wheel\_test021.rar <- it's quick animated but it illustrates
that it works ... if you wnat please help me to simplify the script ... thanks for your atention and
helpful advises!
hank