# Rotate camera on specific value

hello all i need a little help , i am kind of stuck at a silly thing, as you can see i have a camera going through the point cloud back and forth, now i need it to rotate 180 when it gets to each end of the point cloud, so i wont see it going backwards, i can’t for the life of me figure out how do i make this trigger. i made a tale dat with 0 and 180 as values and put it through a constant and filter. i tried if statments in the select values by index but it doesnt really work as i want it. i put it through a constant because the filter doesnt work on the dat to chop for some reason, i need a smooth 180 rotation. would really appreciate if anyone knows how to solve this.

i basically need to change the rotation on specific value and i cant figure out how to do it.
everytime the lfo hits 0.95 i need it to rotate and same when it hits 0.04.
i tried doing it with logic but couldnt get it to work

Hi,

You dont’ say if you need this rotation to be continuous along the length of the path or if you want it to change only at either end of it.

For a change only when you reach the ends of the path I’d try a parameter Execute DAT waiting for changes on your camera Position parameter and a set of simple if then expressions in the onValueChange handler as so:

For a continuous change of the rotation value along the path I’d simply remap the position value onto the rotation value through a math CHOP between 0° and 180° as so:

Hope this helps!

thank you very much yeah i needed it to change once every time it gets to the end, just a question why does the camposition is par.eval()? i mean i tried doing it with executes a few times with if statments, i did something very similar and it didnt really work because lets say you put the if it is <= 0 then only then it will rotate for a seconds no? it will not stay rotated until it get to 1. maybe i am mistaken.

but, i found another way for this to work pretty well
SOLUTION * - so i have found a solution with the logic chop and outside bound option . my lfo values were from 0.04 to 0.95 i put the off while outside bounds 0.05 and 0.94 and the Pre OP in the logic chop on Toggle. that solved the problem it selected a clumn from DAT with the values

Hi there,

The line CamPosition = par.eval() first evaluates the value of the parameter and then assigns it to CamPosition. If you were to simply write CamPosition = par then you would be copying the entire parameter to CamPosition and not only its value. Since a parameter object contains many properties and not simply a value this assignement might not give the expected result.

Regarding your other question, if CamPosition <= 0 and elif CamPosition >= 1 are mutually exclusive because of the else statement implied in elif and values between 0 and 1 will never evaluate to true and can’t affect any changes either. So the rotation value changes to 0° or 180° only when the position reaches the ends and retains that value until it reaches the other end.

Please note that if you indeed use 0.0 and 1.0 as your end conditions and your LFO frequency is too high, the Parameter exec DAT might not have time to evaluate to true within a single frame. It you encounter this problem simply lower your LFO frequency or give yourself a little more headroom by increasing one value and decreasing the other (0.1 and 0.9 for instance).

1 Like

thanks!