Page 1 of 1

Can you move a camera but have IT face a particular spot?

Posted: Fri Sep 17, 2010 2:35 am
by Peteroid
There is an option to make sure a layer will always face the camera.

Is there an option that does the reverse... that is... force the camera to always look at a particular location in 3D space or a particular layer (well, it's location)?

This 'focus point' function would control roll,pan, and tilt values of the camera based on a given (x,y,z) position of the camera, and continue to do so even when the camera is moved (i.e., when the (x,y,z) position of the camera changes, even via interpolation or path following).

What I'm trying to do will make this clear...

I want to have an object at a specific location in 3D space, and be able to move the camera in a circle around the object with the camera always facing the object. This is often used in movies, and was made fun of in 'Superhero Movie' (the actors in the scene get nauseous).

Now, I think I know a trick that will do this for this particular case... keep the camera still and rotate the world. But I want the general case.

I can also do the math, but that would take a long time. That is, take the camera location and the desired 'focus point' coordinates and figure out using trigonometry what the facing direction is (in roll, pan, and tilt) and plug this in.... for EVERY frame since it is not likely going to interpolate with the precision required to make this not look jerky. ouch.

Maybe this feature does exist. What about video tracking, can that be used for this? It seems to be more of a 2D function made for videos, so it doesn't seem like it would. I'm looking for camera 'tracking a position' in 3D...

* * *

If I knew how to do scripting I would do this 'point the camera there' as a script. But I downloaded the stuff in the Scripting forum on how to do LUA scripting for AS, and while the written part of the document is there, ALL the example code is MISSING!

So I have no examples to go by, and it was made clear to me that the documentation has errors in it and the ONLY way to study AS7PRO scripting via LAU is by studying examples... which are missing! (of course, why should this be easy...lol)

Is there a COMPLETE version of this information that can be downloaded from somewhere (and I mean both LUA AND how to use it to manipulate AS7PRO, which are the two different things needed to know)?

This seems like such an obvious camera function... if it's not a built in feature I would think someone would have built a script for just this function by now. If so, pointing me to that would be cool... if not... I'll try to make one and make it available... but that could take some time...

Posted: Fri Sep 17, 2010 9:34 am
by slowtiger
I'd totally do it the other way round.

Create a group layer and put everything inside. PLace the stuff in a way your center if interest is identical with the point of origin of that group layer. Now rotate and tilt to your like ... you don't even have to move your camera.

Posted: Fri Sep 17, 2010 1:21 pm
by Peteroid
slowtiger wrote:I'd totally do it the other way round.

Create a group layer and put everything inside. PLace the stuff in a way your center if interest is identical with the point of origin of that group layer. Now rotate and tilt to your like ... you don't even have to move your camera.
Yes, that will work for the simple case I mentioned. But I was only using it to illustrate what I'm trying to do.

What I really want is for the camera to always be pointed at a character in my animation. I would pick the (x,y,z) of a point on the character, and then have the camera point to that spot.

I want to be able to do this even if the character is moving in a 'complex' way (in 3D space) and have the camera also moving, possible on a totally different route, but ALWAYS POINTING AT THE CHARACTER. This is common in films... I mean... it is a basic simple operation of video cameras to continue to point at the same subject (duh!).

So I want to be able to do this in cases other than just a simple circular motion about the character.

This requires a 'point camera at (x,y,z)'. I mean, come on! This is a CAMERA! The most BASIC operation of a camera is 'point it at THAT'! :)

If this isn't a native ability of AS7PRO (meaning without having to do 3D space trigonometry on the side with another program), it would be a major oversight. EVERY other application I've ever used that used camera's as a way of getting the angle in a 'world', THE most basic operation always given is 'lock the camera on THAT object or point'.

The need for a 'camera-object facing relationship' obviously was thought about, since the 'object always face camera' IS built in.

This would definitely be doable as a script... IF I knew how to do Scripting... and like I said... the info on how to do scripting in (another part) of this forum is missing all the example chapter. So I have no idea even how to learn to do LUA programming for AS7PRO (again, because the info on how to do it here has had all the examples removed for some reason).

Posted: Fri Sep 17, 2010 2:24 pm
by slowtiger
You might have forgotten that AS isn't a 3D application. In 2D, the camera always points at the character, and you'll move backgrounds behind him.

Posted: Fri Sep 17, 2010 2:33 pm
by Peteroid
BTW, after thinking about this problem for a while, I realized 'roll' is not part of the equation, since if a camera is pointing directly at a spot then any amount of rolling will result in the camera still pointing at that spot.

Posted: Fri Sep 17, 2010 2:35 pm
by Peteroid
slowtiger wrote:You might have forgotten that AS isn't a 3D application. In 2D, the camera always points at the character, and you'll move backgrounds behind him.
Actually, AS7PRO IS a 3D application. If it was only a 2D application as you suggest, then there would be no need for TILT camera, right? :)

It's a 3D camera. It's a 3D world. You can build 3D objects. You place things in 3D space. You can even import Poser. Tutorial 5.8 is clearly demonstrating a 3D world:

http://www.youtube.com/watch?v=-zXmttYOLwM

How is this NOT a 3D program?

Posted: Sat Sep 18, 2010 4:47 am
by Peteroid
I'm a computer programmer (have been for...OMG... 40 years...). Actually, I'm a computer game designer... but that's not important right now... :)

Today I wrote a small program that does what I've been talking about in this thread. I give it the (camx,camy,camz) location of the camera and another (x,y,z) point in 3D space, and it computes the pan and tilt for the camera to face directly at the point. And it works really well!

But, to really make this work best, I have to to this for every frame I want this affect. So the best way is for me to make this into a LUA script.

THAT might take some time since, like I said above, the info available for using LUA with AS7PRO that can be obtained form this website is missing all the example code... and this is necessary for study (according to Vern).

So, if someone can tell me where I can get the missing AS7PRO LUA code examples, I might be able to do this soon and give it to everyone! :)

Posted: Sat Sep 18, 2010 7:15 am
by DK
Wow Peter. Great to have your knowledge and abilities on the forum! Vern's the guy who can point you in the right direction for the AS7 Lua code. He's quite flat out with a huge job we're doing at the moment. I'll mention this thread to him though.

Cheers
D.K

Posted: Sat Sep 18, 2010 10:36 am
by Genete
So, if someone can tell me where I can get the missing AS7PRO LUA code examples, I might be able to do this soon and give it to everyone!
Hi Peter,
I'm amateur coder and didn't know a word of Lua the first time I faced the scripting issue. Lua is pretty easy to learn itself. Nothing complicated. The missing examples never existed. But there are lots of them around. There is a thread with a collection of links with the scripts more interesting around the time. Also newest scripts are floating up in the Scripting forum.
Regarding to script documentation the good one is the old one, the given in this thread. The second script documentation provided is just the equivalent to a very poor commented header of a C++ file. If you're a programmer you know what I'm talking about. It (the newest scripting reference) can be used later for advanced uses of new features but the old one is enough to start to code.
None here has had never those set of examples or more information that the one that can be found in the forum or the built in scripts.
Good luck.
-G

Posted: Sat Sep 18, 2010 2:17 pm
by Peteroid
Thanks DK and Genete!

I'll start studying LUA and how it works with AS7PRO immediately... :)

Posted: Sun Sep 19, 2010 6:48 pm
by neeters_guy
Here's old thread by a veteran scripter who explains how a script is structured:

Dissecting a menu script : Draw Triangle

It's not a reference, but I find it to be a useful overview.