Hi cameni !
I would like to add zoom to vehicles and boats. But if I just copy the code from the cessna 172 putting this.register_axis("air/sensor/fov_zoom", {minval:0, maxval:1, vel:1, center:0}, function(v) ....
into init_chassis where it belongs I well can get the zoom to work but when exiting the vehicle or boat the zoom remains as last set..which is very annoying... whereas for the cessna it resets automatically to the default zoom. Seems that exiting a plane behaves differently from exiting a vehicle/boat ..from the camera view perspective.
I tried to solve this issue using the code below and it works for a single vehicle/boat but when I spawn a second one I get a black screen. Also I need to set the default FOV manually in the script .copying the FOV value of the menu into the script. Is it possible to get it via the world interface ? OR is there a completely different way to set FOV to get the default FOV back when exiting a vehicle/boat ?
function init_chassis(){
...
this.fov=83;// as set in the outerr amenu
this.fov_cockpit_zoom = this.fov;
this.register_axis("air/sensor/fov_zoom", {minval:0, maxval:1, vel:1, center:0}, function(v){
var dec2int = v*80;
var integer = Math.floor(dec2int);
var string = this.fov - integer.toString();
this.fov_cockpit_zoom = string;
});
}
function update_frame(dt, engine, brake, steering, parking){
..
if (this.get_camera_mode() == 256){ // if not inside the vehicle
this.fov_cockpit_zoom=this.fov;
}
this.set_fps_camera_fov(this.fov_cockpit_zoom);
..
}