Controlling the value with a property.

Hi.
I am learning a bit of py and i really need to know how to control a value with a propriety, i want my script to copy the values from propriety.

import bge

scene = bge.logic.getCurrentScene()

cam = scene.active_camera

cam.lens = 100.0

I want to control the cam lens in realtime with propriety,
A blend file would be greatly appreciated!


import bge
cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()
cam = scene.active_camera 
cam.lens = own["lens"]

using the property ‘lens’ on the script controller object

If the object with the script running on it is the camera, use this:


import bge
cont = bge.logic.getCurrentController()
own = cont.owner
own.lens = own["lens"]

using the property ‘lens’ on the script controller object

Thanks! it works.

I ve been making some other scripts and really works, so nice!