This has bugged me for quite a few days (still unsolved :( )

First off, say I have a ball object that rolls in the direction using the rigid body physics depending on what arrow keys I push, and I have a camera following it. Now for the camera i’m currently using the camera actuator for it. But I need a more advanced camera system in which would work in that the camera would follow the ball depending on the direction it’s going on the X,Y axis while not going up and down on the Z axis unless the center of the ball object changes position on the Z axis. Plus the camera should remain the exact same distance from the ball that is the distance it started from the ball the moment the game starts up not going any farther nor any closer to the ball but still following it in the fashion I described above. For the past several days i’ve made some attempts like using vertex parenting, a dummy cube for the camera that goes with the ball and even setting up four empty’s around the ball that the camera shifts around with based on a camera variable. But it got me nowhere and i’m still at the position in which I started. So here’s the question, how can I make the camera do this using logic bricks or is there a python script that can do this? I’ll accept answers in either logic bricks or in python scripting.
I really need the answer, if I don’t I can’t continue on the game. :frowning:

It should be fairly simple to make this type of camera control with a Python script.

A script could be written that gets the ball’s position and velocity, then sets the camera’s X Y position so it’s behind the direction the ball’s going, and set it’s Z position to equal the ball’s. The function getLinearVelocity() could be used to get the direction the ball’s traveling…

One problem, I don’t know python and even if I can learn it (which I could actually) I don’t have much of an idea about how to put it in the game engine :frowning:

Well, learning Python is a good idea, and it’s not that hard to put it in the game engine once you know how to use it.

I’ve done some testing of a script like I suggested, and there are a few problems. When the camera rotates around the ball, it becomes hard to predict which way it’ll go when you press one of the arrow keys. This could be corrected, but would require a much more complicated script.

If I could see how you’re moving the ball while using the camera actuator, it might be a help. Could you upload a .blend file?

Sadly I don’t have any space to upload to, but i’m using the camera actuator currently in the camera object, left the first 2 blocks like they were and in the third block set it to camera, put in the ball object in the blank, set min and max to 16 and put height to 8.

Anyone have an answer for this, I don’t care if it’s in logic blocks or one big python script I just need it as soon as I can.