Hey all, a request for help if I may
I've got a camera following an arbitrary path around a SSC object, which is centered on the origin. I'd like to have the camera orientate itself towards the scope's centre.
I can do it easily enough in 2d with atan2 and I assumed I'd just need to extend that into 3d, maybe with a bit of Pythagoras, but I'm not making any headway
<edit> Does it matter which order I'm rotating the axes? It's x,y,z right now </edit>
Tell me straight... am I missing the obvious?
help with camera rotation
8 posts
3D SuperScope (incl. rotation) link
thanks m2k but the 3d part I'm more or less comfortable with. I was looking more for a way to make the camera point to the origin (i.e. calculate rx, ry and maybe rz, based on the camera coordinates), as it will be following various paths blended together randomly and I always want the scope in view
might not help, but here's the preset. feel free to point out any other corrections 😉
might not help, but here's the preset. feel free to point out any other corrections 😉
there's a method for that that's pretty simple once you know its derivation. unconed uses it in his energy ball preset and other similar endeavours of his, if you want to take a look at that code. it's kind of dodgy code if you don't know raytracing in avs, but that's the best advice i can give you for the moment...i'm far to tired to be trying to derive those formulas right now 😉
good luck
good luck
nice preset btw🙂
ry=atan2(-ox,-oz);
rx=atan2(oy,sqrt(sqr(oz)+sqr(ox)));
rz=0;
this is for zxy rotated superscopes for zyx just swap appropriate vars.
it comes from pythagoras theorem and some trig, draw a 3d diagram to see how it works.
rx=atan2(oy,sqrt(sqr(oz)+sqr(ox)));
rz=0;
this is for zxy rotated superscopes for zyx just swap appropriate vars.
it comes from pythagoras theorem and some trig, draw a 3d diagram to see how it works.
This formula depends on the order of your rotations. The most natural is z,x,y (or reverse for camerabased scopes).
took a little experimenting, but got it!
appreciate the help, thanks!
appreciate the help, thanks!