in 3rd person mode, my camera pushes out it’s near clipping plane when zooming in,
(zoom in through obstacle)
So, this is the code
sens2 keyboard is actually a property/ boolean now (so you don’t have to hold tab to go to first person)
sens = is actor alive
sens3= Right mouse
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['Property1']
sens2=cont.sensors['Keyboard']
sens3=cont.sensors['Mouse']
if 'Cam' not in own:
scene=bge.logic.getCurrentScene()
own['Cam']=scene.objects['CamPos1']
own['Cam2']=scene.objects['CamPos2']
else:
if sens2.positive:
cam=own['Cam']
own.worldPosition=(cam.worldPosition+own.worldPosi tion*15)*0.0625
own.worldOrientation=(cam.worldOrientation+(own.wo rldOrientation*3))*.25
if own.lens<=59 and sens3.positive:
own.lens+=1
own.near=6
else:
if own.lens>=29 and not sens3.positive:
own.lens=int(own.lens-1)
own.near=.1
else:
cam=own['Cam2']
own.worldPosition=(cam.worldPosition+own.worldPosi tion*7)*.125
own.worldOrientation=(cam.worldOrientation+own.wor ldOrientation)*.5
own.near=.1
if own.lens<=74 and sens3.positive:
own.lens=int(own.lens+1)
else:
if own.lens>=39 and not sens3.positive:
own.lens=int(own.lens-1)
main()
this handles camera position zoom and clip for my own game
I thought it was handy
you could use a ray and do Zoom + push out near clip in your own games, to “zoom through” obstructions