Rotating a camera around a still ball (mini golf aiming)

I’m making a mini golf game and I’m completely finished apart from this one detail. Once the ball is shot I want to be able to rotate the camera around the ball to see the hole, but right now the camera is stuck on a single axis right behind the ball. I used thismethod to parent the camera to the ball to eliminate camera roll.

I’m not looking for a 360 animation, just to be able to reposition the camera while maintaining centering on the ball

Here’s my blend file if you want to take a look!
https://drive.google.com/file/d/0BxB2pKMjGzzqT3dldXVhZkZkTkU/view?usp=sharing

Can you re-upload your .blend to pasteall.org? Google warned me that your file’s too big for a virus scan, so I’m a bit nervous about downloading it.

Max file size is 30mb, mine is 47 :frowning: I’ll see if I can find another host

Is megaupload ok?

http://www.megafileupload.com/jl04/shottesting.blend

Add a empty, put it at the balls location

Vertex parent the empty to the ball

now parent the camera to the empty,

Rotating the empty should rotate the camera without effecting the ball.

if vertex parent gives you a offset you don’t like

you can always use

inside empty

always--------python


import bge
cont = bge.logic.getCurrentScene()
own = cont.owner

if 'Ball' not in own:
    own['Ball']=own.scene.objects['NameOfBall']
else:
    own.worldPosition = own['Ball'].worldPosition

thank you!! that worked perfectly

I was using empties but not in the correct way, much appreciated!

an intresting note, you can use the camera local Z axis to push your ball.

own[‘Ball’].applyForce(own[‘Camera’].worldOrientation.col[2]*(-Force),0)

Negative force, because camera forward is -Z

to get access to a camera, you have a few options.

own.scene.active_camera()

and own.scene.objects[‘NameOfCamera’]