ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator zooming with keyboard button
person icon
isamarty
Guest
Quote
2021-05-21 19:14:44

please help me

i want to zoom camera when click on a 2d overley


i have tested the extension(script) but it wont work on android

please soomeone make me a script which zoom camera with keyboard buttons i will then port it on 2d touch overlay please please

person icon
Sven
Guest
Quote
2021-05-22 18:22:18

This should give you idea. (read comments that i added in script-file)

/*
<behavior jsname="behavior_Keyboard_M" description="KEYBOARD EXAMPLE">

</behavior>
*/

var keyp=0;//on android change it.. if overlay1 (zoom in) clicked then keyp=77 if overlay2 (zoom out) clicked then keyp=78
var counter=0;

ccbRegisterKeyDownEvent("keyPressedDown");//on android remove it
function keyPressedDown(keyCode)//on android remove it
{//on android remove it
keyp=keyCode;//on android remove it
}//on android remove it


behavior_Keyboard_M = function()
{
};

behavior_Keyboard_M.prototype.onAnimate = function()
{




//IS M PRESSED DOWN
if (keyp==77 )//on android change it.. if overlay1 (zoom in) clicked then keyp=77 if overlay2 (zoom out) clicked then keyp=78
{
keyp=0;//RESET
counter+=0.1;
var cam = ccbGetActiveCamera();
var Fov = ccbGetSceneNodeProperty(cam, 'FieldOfView_Degrees');
ccbSetSceneNodeProperty(cam, 'FieldOfView_Degrees', Fov-counter);
}

//IS N PRESSED DOWN
if (keyp==78 )//on android change it.. if overlay1 (zoom in) clicked then keyp=77 if overlay2 (zoom out) clicked then keyp=78
{
keyp=0;//RESET
counter+=0.1;
var cam = ccbGetActiveCamera();
var Fov = ccbGetSceneNodeProperty(cam, 'FieldOfView_Degrees');
ccbSetSceneNodeProperty(cam, 'FieldOfView_Degrees', Fov+counter);
}


return true;
}




Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |