Copy link to clipboard
Copied
Hey,
I know Dan a while back posted an Auto-Orient script (as opposed to Transform.Auto-Orient function). Is there a script about that incorporates Roll/Lean/Banking to the movements and inertia as feel adds a nice effect to cameras when they move like that.
I know Dan has an expression for overshoot inertia and that SureTarget / MonkeyCam Pro has these functions, but want to have some granular / more manual control over them. So knowledge is definitely out there, I don't know how to combine it all though.
Copy link to clipboard
Copied
Entirely depends on what exactly you are looking for. All the scripts you mentioned are based on cheat methods that fake inertia and forces linearly, but calculating yaw/ pitch/ roll is an entirely different thing since it's not just dependentn on the actual mass but also the distribution of the mass in relation to the pivot point. So for what it's worth you will have to explain more specifically what kind of motion you're looking for or this could become endless. Calculating the motion information itself already adds a layer of extra code here.
Mylenium
Copy link to clipboard
Copied
Doing a realistic banking inertia simulation requires you to calculate acceleration/deceleration, which is tricky with expressions. I've done it in the past by going back from the current time, frame-by-frame, for a set number of "samples", calculating the acceleration as the incremental change in velocity (from the previous frame) and giving each value a diminishing weight based on how long ago the sample was. Not particularly efficient (or accurate) but it can give a fairly convincing result.
Copy link to clipboard
Copied
Ah ok. Also as part of this Camera stuff, I was trying to get a One-Node Camera to Ease between targets as sometimes keyframing POI becomes quite a mess.
I have it working for one target using LookAt() but is it possible to ease between multiple using Layer Controls? I'm not sure how the weighting would work though, because would need a 0-1 Slider Control for each. Not that good with maths or coding so fumbling about in dark at moment and brainpower expired, feel this might be useful for just general layer rotation as well.
// Camera LookAt Single Target
target = thisComp.layer("ONE");
fade = 0.01;
lookerPos = transform.position;
targetPos = target.toWorld(target.anchorPoint);
angle = lookAt(lookerPos,targetPos);
fade = clamp(thisComp.layer("Camera 1 - Control").effect("Slider Control")("Slider"), 0.01, 1);
total0 = fade * angle[0];
total1 = fade * angle[1];
total2 = fade * angle[2];
rem = 1 - fade;
a0 = linear (rem, total0 / fade, value[0])
a1 = linear (rem, total1 / fade, value[1])
a2 = linear (rem, total2 / fade, value[2])
if (fade == 0){
value;
}else{
[a0,a1,a2];
}
Copy link to clipboard
Copied
This will never work. lookAt() produces Quarternions and not stable Euler angles, so any interpolation based on that would be utterly random as the angles change with every frame. You would need to convert the angles first. Outside that it seems you merely want some arbitrary delay, after all, and that can be achieved with the usual delay/ bounce code once you have the angles figured out. Nothing in your setup indicates any real need for actual rotational calculations or inertia.
Mylenium
Copy link to clipboard
Copied
I don't understand the above script works 100%, what errors did you get your end or was your answer speculative?
To reiterate:
The only error above is the false==0 is not being used as fade was temporarily set above 0 as a quick fix to divide by 0 errors. What I am asking is can you interpolate between angles like you can with layers positions with:
var total = 0, totalWeight = 0, remWeight = 0;
function addTarget(name) {
var layer = effect("Target " + name)("Layer");
var pos = layer.toComp(layer.anchorPoint);
if (hasParent) layerPosition = parent.fromComp(layerPosition);
var fade = thisLayer.effect("Fade "+name)(1);
total += fade*pos;
totalWeight += fade;
remWeight = 1 - totalWeight;
}
addTarget("A");
addTarget("B");
addTarget("C");
addTarget("D");
totalWeight==0 ? value : linear(remWeight,total/totalWeight,value);
Copy link to clipboard
Copied
Just to explain clearer what I am trying to understand, quick 1:30s vid: https://youtu.be/D7oBpfTygLg
Copy link to clipboard
Copied
You might be able to use sure-target from Video Copilot. Check it out, and see if that helps you.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now