Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
I (maybe stuipidly) decided to try to animate using the expression editor. I would like an object to rotate back and forth between two set points on its axis ideally at random.
if(Animation_Control.aniCon == 2){
int $maxRot = rand(90, 110);
int $minRot = rand(-10, 10);
// 1 = postive rotation || 2 = negative
int $rotDirect = 1;
if(Drone_Head_Mid_Antener_Pivot.rotateZ <= $maxRot && $rotDirect == 1){
Drone_Head_Mid_Antener_Pivot.rotateZ = time*3;
} else if(Drone_Head_Mid_Antener_Pivot.rotateZ >= $maxRot && $rotDirect == 1){
$rotDirect = 2;
$maxRot = rand(90, 110);
}else if(Drone_Head_Mid_Antener_Pivot.rotateZ >= $minRot && $rotDirect == 2){
Drone_Head_Mid_Antener_Pivot.rotateZ = -time*3;
} else if(Drone_Head_Mid_Antener_Pivot.rotateZ <= $minRot && $rotDirect == 2){
$rotDirect = 1;
$minRot = rand(-10, 10);
}
I tryed to get this fucntionality working using this code. However when this runs it rotates round to to around 100 degrees and then stops doing nothing more. Does anyone have any advice to help with this?
Thanks in advance.
Solved! Go to Solution.