You are not logged in.

1

Thursday, October 3rd 2013, 1:44pm

Custom key to change scene

Hi, how i can set and use a keyboard letter like "N" to go to next scene?
Thanks.

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Thursday, October 3rd 2013, 1:59pm

Hi!

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    <events devices="desktop"
        onkeydown="keydown();"
        onkeyup="keyup();"
    />

    <action name="keydown">
        if(keycode == 37, set(hlookat_moveforce,-1));
        if(keycode == 39, set(hlookat_moveforce,+1));
        if(keycode == 38, set(vlookat_moveforce,-1));
        if(keycode == 40, set(vlookat_moveforce,+1));
        if(keycode == 16, set(fov_moveforce,-0.2));
        if(keycode == 17, set(fov_moveforce,+0.2));
    </action>

    <action name="keyup">
        if(keycode == 37, set(hlookat_moveforce,0));
        if(keycode == 39, set(hlookat_moveforce,0));
        if(keycode == 38, set(vlookat_moveforce,0));
        if(keycode == 40, set(vlookat_moveforce,0));
        if(keycode == 16, set(fov_moveforce,0));
        if(keycode == 17, set(fov_moveforce,0));
    </action>
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

3

Thursday, October 3rd 2013, 2:01pm

VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Taurus

Trainee

Posts: 140

Location: Belarus

Occupation: photographer & virtual tour developer

  • Send private message

4

Thursday, October 3rd 2013, 2:03pm

you can use events onkeydown/onkeyup and keycode variable


Serge
--------------
Andrey, *smile*
--
in order to comply the word with the affairs, you need to keep quiet and do nothing!

Virtual tour Gomel
Virtual tour
Virtual tour
Elbrus
...

Windows 10x64 & krpano 1.20

5

Thursday, October 3rd 2013, 3:29pm

Thanks for quick reply, where i can find the list of all keyboard keycode?

UPDATE
I have find a page for the keycode here:
http://www.cambiaresearch.com/articles/1…codes-key-codes


And i have used this code:

<events devices="desktop" onkeydown="keydown();" onkeyup="keyup();" />

<action name="keydown">
if(keycode == 78, nextscene());
if(keycode == 80, prevscene());
</action>

<action name="keyup">
if(keycode == 78, set(hlookat_moveforce,0));
if(keycode == 80, set(hlookat_moveforce,0));
</action>

<action name="prevscene">
copy(sceneindex, scene[get(xml.scene)].index);
sub(lastindex, scene.count, 1);
dec(sceneindex, 1, 0, get(lastindex));
loadscene(get(scene[get(sceneindex)].name), null, MERGE, BLEND(0.5));
</action>

<action name="nextscene">
copy(sceneindex, scene[get(xml.scene)].index);
sub(lastindex, scene.count, 1);
inc(sceneindex, 1, get(lastindex), 0);
loadscene(get(scene[get(sceneindex)].name), null, MERGE, BLEND(0.5));
</action>


Thanks.

This post has been edited 1 times, last edit by "grollaz" (Oct 4th 2013, 2:57pm)


6

Thursday, October 3rd 2013, 3:40pm

Anyone know why when i paste my code in the code tag, it not keep the line break?
Thanks.

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

7

Friday, October 4th 2013, 1:42pm

Hi!
it's some forum issue
just add double line break

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

8

Friday, October 4th 2013, 3:04pm

Ok thanks, i hare removed the code tag and now is ok.