first perso scene

28 October 2016 15:25

thanks again for your work

i follow the tutorial for first person scene but encounter strange behaviour

when i press the button W to go forward, the character go left, and other controls are not in the good direction
I think i do something wrong, but can't found..

Any idea?

PS : i'm on a azerty keyboard, what's the best way to use ZQSD instead?
08 November 2016 12:48
Hi! You did nothing wrong, this is our fault .

This happens because the character view direction doesn't match with the camera one. But when you move a mouse a little bit the behavior instantly becomes normal.
To fix it you need to align the initial character orientation as follows:

var m_cam = require("camera");
function load_cb(data_id) {
    // add these lines after the "m_cons.append_stiff_trans" call
    var angles = m_cam.get_camera_angles_char(camobj);
    m_phy.set_character_rotation(character, angles[0], angles[1]);

So, the tutorial you followed currently doesn't explain this moment, but we're planning to simplify the setup of the first-person mode in a short time, hence the tutorial will be updated soon.
08 November 2016 18:01
perfect, thanks

Good Work ;)
10 November 2016 11:44
PS : i'm on a azerty keyboard, what's the best way to use ZQSD instead?
The simplest way now is to change the keys in the source code. In the future we'll eventually support the most popular layouts.

Here, in the app.js file you can change them to whatever you want: link.

For example:
key_w = m_ctl.create_keyboard_sensor(m_ctl.KEY_Z);
key_s = m_ctl.create_keyboard_sensor(m_ctl.KEY_S);
key_a = m_ctl.create_keyboard_sensor(m_ctl.KEY_Q);
key_d = m_ctl.create_keyboard_sensor(m_ctl.KEY_D);
key_r = m_ctl.create_keyboard_sensor(m_ctl.KEY_R);
key_f = m_ctl.create_keyboard_sensor(m_ctl.KEY_F);
Please register or log in to leave a reply.