User posts hugodi
08 August 2017 21:56
Ok so I called enable_camera_controls(); and then I use enable_fps_controls. Camera controls has the gamepad interface more complete and the right joystick control the eyes automaticly.
I did'nt knew I could use different controls at the same time… It's so simple I'm angry I spent so long on this trying to code something in the rotation callback !!!
So if anyone else try to do this here is my code :

var character = m_scene.get_first_character();



and I struggled a lot on changing the controls of my character to AZERTY so here it is :

            forward_sens: [m_ctl.KEY_Z, m_ctl.KEY_UP ],
            backward_sens: [m_ctl.KEY_S, m_ctl.KEY_DOWN ],
            right_sens: [m_ctl.KEY_D, m_ctl.KEY_RIGHT ],
            left_sens: [m_ctl.KEY_Q, m_ctl.KEY_LEFT ],
            jump_sens: [m_ctl.KEY_SPACE, m_input.GMPD_BUTTON_2 ],
            lock_camera: true

Will, I'm using an old controller I had in a drawer, some details are strange on it and most of my videogames don't recognize it, but blend4web made it easily useable !

Also this website was helpful to find how my controller work
Thanks for the help Will !
07 August 2017 20:10
Ok I fixed my side problem and I'm back on my main question !
My problem was that for some reason when you try to change the parameters of the enable_fps_controls the lock_camera goes to false by itself, so I now have
forward_sens: [m_ctl.KEY_U ],
lock_camera: true
However I still have no clue on how to link camera rotation to gamepad axis. The first person example in the Jungle oupost is not a example since you can look around only by using mouse but not gamepad.
I am trying to modify the rotation_cb parameters of enable_fps but I don't really now what I should put in it to link it to my gamepad axis…
05 August 2017 17:39
Yes I have looked long inside firstperson and FPS module and yet I can't find the answer…
So to begin I only try to change the controls and I can't even do that…
So let's say I want to move forward with U instead of Z, I write :

forward_sens: [m_ctl.KEY_U, m_input.GMPD_BUTTON_12]

But no only it don't work but all the controls stop working afterwards.
What am I doing wrong ?
Thank you !
03 August 2017 16:59
Hello Will !
Thank you for your quick response !
Sorry this is stupid question but I've tried so many things and I cannot find how to modify anything using enable_fps_controls.
Could you help me by showing how am I supposed to modify the options like rotation_cb or forward_sens ?
For forward_sens I've tried to pass arguments like " forward_sens : [KEY_Z] or forward_sens : [m_ctl.KEY_Z] or even trying to define key_z by using m_ctl.create_keyboard_sensor(m_ctl.KEY_Z); and then passing it as a variable but nothing does the trick.
But my main problem is rotation_cb; the API doesn't even show any default information, what am I even suppoed to use ?
Maybe I'm not skilled enought with javascript but I don't find any clear explanation on this anywhere.
Thank you so much for some clarifications !
02 August 2017 19:03
I'm new to blend4web and I love it so far !
I'm trying to do a fps game that would be playable with a gamepad.
My controls would be very similar to the one you show in your youtube demo smartphone + gamepad
So far I can move around using the axis 0 and axis 1 that correspond to the left joystick of my controller.
However my camera is always looking in the same direction and I cannot find how to control the camera/character looking direction using the right joystick (that would be axis 2 or 3 and axis 4 with my controller).
How can I do that please ?
Thank you very much !!