I’v some problems with a camera who rotate on a target.
I explain :
I have a camera who rotate around a target when I move the mouse.
I want zoom and zoom out with the mouse wheel and I want she was blocked by physical objects like floor, walls , etc.
Actually only the motion of rotation work.
Could someone help me?
I use Blender 2.68 and here is my camera code :
from bge import logic as G
from bge import render as R
from bge import events
sensitivity = 2.0
cont = G.getCurrentController()
owner = cont.owner
if “oldX” not in owner:
G.mouse.position = (0.5,0.5)
owner[“oldX”] = 0.0
owner[“oldY”] = 0.0
x= 0.5 - G.mouse.position
y = 0.5 - G.mouse.position
x *= sensitivity y *= sensitivity * 0.1 owner['oldX'] = (owner['oldX']*0.99 + x*0.01) owner['oldY'] = (owner['oldY']*0.99 + y*0.01) x = owner['oldX'] y = owner['oldY'] owner.applyRotation([0, 0, x], False) owner.applyRotation([y, 0, 0], True) G.mouse.position = (0.5,0.5) zoom = owner["zoom"] keyboard = G.keyboard.events if keyboard[events.WHEELUPMOUSE]: zoom -+ 1.0 if keyboard[events.WHEELDOWNMOUSE]: zoom+=1.0 owner.scaling = [zoom, zoom, zoom] owner["zoom"] = zoom