Camera Trouble

I have a basic third person game where I can move the ball around with the WASD keys. The camera is set to zoom in when I hold the up arrow and zoom out when I hold the down arrow. I wanted the camera to rotate around the ball so I can get a good paneramic view of the level. I’ve been playing around in blender for about a month and I love it so far but if someone could tell me how to get the camera to move with the left and right arrow keys while continuously lookin at the ball, I would greatly appreciate it.

Hello, I was trying to do the same :slight_smile:

Found it:

  • create a empty at the camera rotation center
  • parent the camera to the empty
  • rotate the empty -> camera rotate around the empty pointing at it

Xat, if the ball is rolling that method wont work. The camera would roll around as well, and it would be a very difficult camera to control.

Andre, it depends on if your ball is rolling or not (if it doesnt then u can use the above method). If the ball does roll however, it would probubly be best to use the camera actuator on the camera.
Then assign some more logic bricks to get the camera to move left and right when the appropriate keys are pressed.

Id send you an example .blend, but its late and im about to head off for the night. If you have trouble working it out ill see if i can knock one up for you tomorrow.

It would be good to know if the ball is a rigid body though.

You can vertex-parent the empty to the object, and it will only move with the object, not rotate with it. Select the empty, then the object, then go into editmode (tab), select a vertice, and hit ctrl-P. Now parent your camera to the empty, and you can have your ball roll.

sorry, total newb here (for the GE at least)

If the ball is rolling, could you set rotation constraints on the empty the camera follows? Or perhaps not even that, isn’t it possible to have the empty inherit only loc and not rot?

Did you read my post? That is exactly what vertex parenting does.

I actually tried the parent vertex which is how I got zoom to work and how I kept the camera from rotating. I also tried the camera constraint and it zooms underneathe the ball. I want it to use the ball as an achor and just pan around at the height it’s currently at. Would I have to eliminate the parent to vertex option before I try the camera constraint? o.0

Yeh its probubly best to eliminate any parenting before you use the camera constraint. The two interfere.
The most important thing with the camera constraint is to make sure that the OB field has the name of the object you want to look at specified. And make sure you have the height set to a proper value, as well as the max and min distance (this could be the reason why it zooms underneath the ball).

It takes a bit of trial and error, but you should be able to get it exactly how you want.

I didnt know about that, sounds pretty good though! Ill have to give it a go sometime.

So when I eliminated the parent to vertex option it sent the camera above the ball but it never followed the ball. So I set a track to constraint and it still didn’t follow. Does anyone know of a python script or something that would make this easier?

I actually tried that but the camera just moves away from the ball and it doesn’t look at it at all. By the way, found an excellent website for blender tutorials, none I currently need for the project but great for other things.

Ive uploaded a basic .blend

Take a look at the camera logic setup. Ive also got it to rotate around the object using the left and right arrow keys (ball control with W,A,S,D).
The ball controls arnt that good though, but it should demonstrate it ok.

I appreciate you showing me that. Not exactly the results I wanted sine I still needed zoom, but you made me realize that that made my game a little harder. Sorry for making you go through the effort for me just to say I don’t need it. :o

Yeh thats ok.
Im not sure how u did the zoom, but you could easily just animate the lens on the camera to get a zoom effect. It would work with the demo i made. But i guess the way u set up ur game is completely different. :cool:

The way I got the camera to zoom was by parenting the cam to a vertex on the ball. Then I went to the GE panel and set the actuator to motion DLoc = .10 on the Z axis (far right box on the motion actuator tab). This caused the camera to track the line down towards the ball without having to add effects to create a zoom or use a python script, but it’s just because I’m lazy. :smiley: