Dynamic rotation of a camera to view objects

Hi guys,

Basically I have some basic collision detection attached to my character, when he walks into a plane, a video plays (the video is attached to the plane). I have zoomed the camera out to view the video, however I can’t work out how to dynamically rotate the camera so the plane is in the center of the screen. Obviously if the character walks into the side of the plane, the video plays and the camera zooms out, but the video is not visible.

Somehow I need to create a smooth movement between the camera being behind the character to it going face on with the plane.

The first thing I tried was creating a pydriver, when the character collided with the plane, the camera rotated to the same rotation of the plane, however it was literally a quick flip. I need to somehow create a smooth motion between the two. If you’re familiar with Flash, I need to create a motion tween.

Has anybody got any ideas of how I could achieve this?
Thanks,
Will

You want to see the video and the character at the same time? So the plane is like a videoscreen?

Hi Monster,

Yeah that’s the concept. When the character collides with the plane, the camera should pan around to view the video playing on the plane.

What I do in this situations is following (uses Python code):

have a camera that follows the player (playerCamera)
have a camera that shows the video (theaterCamera)

now have one camera that you are looking through (activeCamera)

I’m to lazy to explain this… append the objects Parent and Mover from this quick and dirty file:

Switch camera demo.blend (44.2 KB)
These are not cameras as the name suggested, but the object type does not really care here.

Set the property target according to your needs.
I hope it helps
Monster

Hi Monster,

That is perfect!
Thanks for your help.

Best,
Will

I have tried to replicate what you have done in a new project so I can understand what you have done so I can add it to my project, but I’ve hit a problem.
When I move to the new position, it suddenly jumps from one position to the other, so I don’t get the nice movement which is in your example project.

I have looked through and as far as I can see there is no difference between the two projects (apart from I’ve added one less cube, but that shouldn’t effect it right?)

If you have a moment, would you be able to look at my attempt to see what I’m doing wrong? No doubt it is something really simple that I’ve missed out, but I just can’t see it at the moment.

Thanks,
Will

Attachments

switch_test.blend (147 KB)

I just guess you haven’t enabled slowParent

but let me check…

good guess ;):


simply switch on slowParent

Amazing, thanks Monster! The slow parent button is quite hidden.

Best,
Will