Mouse drag without holding LMB
28 July 2016 11:31
Hello,
I'm trying to make a FPS type of movement. The mouse rotation is defined as:
It works ok if I hold the LMB but, how can I make the rotation without holding it? Should I use other function than request_mouse_drag?
I'm trying to make a FPS type of movement. The mouse rotation is defined as:
function mouse_rotation_cb(rot_x, rot_y) {
m_phy.character_rotation_inc(_character, rot_x, 0);
if (rot_y) {
m_cam.eye_rotate(camobj, 0, rot_y);
m_cam.get_camera_angles(camobj, _vec3_tmp);
offset[2] = -dist * Math.cos(_vec3_tmp[1]);
offset[1] = -dist * Math.sin(_vec3_tmp[1]);
m_cons.remove(camobj)
m_cons.append_semi_stiff_cam(camobj, character, offset);
}
}
var canvas_elem = m_container.get_canvas();
canvas_elem.addEventListener("mousemove", function(e) {
m_mouse.request_mouse_drag(canvas_elem, null, mouse_rotation_cb);
}, false);
It works ok if I hold the LMB but, how can I make the rotation without holding it? Should I use other function than request_mouse_drag?
28 July 2016 11:38
I'm trying to make a FPS type of movement.Hello!
You can take a look at "Jungle Outpost" tutorial article https://www.blend4web.com/en/community/article/103/ (the project is included in the SDK). It is exactly about the first person movement