Forum

User posts dallas3d
24 November 2015 14:24
One last thing and I'm all set:

I would like to be able to use the mouse pointer to click-select objects in the same scene. Pointerlock interferes with that. How do I integrate the two 'modes' smoothly? If possible I'd like to have the pointerlock only engaged when the lmb is being held down, or, if not, do this in a way that avoids pointerlock.

To boil it down in simple statements:

- lmb held down -> rotate character/camera
- lmb clicked -> select object in scene

Thanks for all the help, this thing's been a real headache so it'll be nice to put it to bed.
24 November 2015 13:48
Mystery solved! I was so locked in on getting this issue fixed that I never noticed the browser flashing a pointer-hiding permission dialog off to the side.

Also, thanks for the cache disabling tip - I have had to clear it at times, and it's annoying.
24 November 2015 13:22
Making progress at last! I still have two issues:

- This works for me in Chrome but not Firefox (v 42.0)
- In Chrome, the pointerlock does not disengage when I let go of the mouse button

24 November 2015 12:23
I missed the paper clip - it's been a very tiring month.
23 November 2015 20:30
The free and pro packages still contain the old version of the scene - no rotation_cb in the .js file.
22 November 2015 00:13
Since my last post went in a different (but important) direction, I'm going to shift my big problem over here. I'm also going to explain in another way, hopefully making my problem clearer.

I want to know how to replace the second part of the code with manifolds so that it can be used with the first (I used semi-stiff constraint in my scene, because I want to be able to rotate the camera up and down independently of the character).

var rotate_left_right = m_ctl.create_mouse_move_sensor("X");
var rotate_up_down    = m_ctl.create_mouse_move_sensor("Y")


code to be replaced:

if (oldX < e.pageX) {
        m_phy.character_rotation_inc(_character, -.01, 0);
				
    } else {
	m_phy.character_rotation_inc(_character, .01, 0);
    }
 
    if (oldY < e.pageY) {
        _camang = m_cam.get_camera_angles(_cam);
		_camang[1] = _camang[1] - _caminc;
		m_cam.rotate_camera(_cam, _camang[0], _camang[1], true, true);
    } else {
        _camang = m_cam.get_camera_angles(_cam);
		_camang[1] = _camang[1] + _caminc;
		m_cam.rotate_camera(_cam, _camang[0], _camang[1], true, true);
    }
 
    oldX = e.pageX;
    oldY = e.pageY;


I can refine the rest after, but this is where I'm still stuck.
21 November 2015 02:50
Evgeny - glad I helped with a fix!

After tweaking my code based on ben's example, I am still having issues with mouse-controlled rotation. I'm sure I'm missing something. I've attached my .js file so that I can finally get this resolved.

Also, I guess the above mouse.js fix gets applied when you compile the engine - is there a way to do this with the existing b4w engine file(s)? If not, what's the easiest way to tie my existing project in with the new management system? I tend to want to get stuff done fast, and up to now it's been convenient to do things the old way. Thanks.
20 November 2015 11:49
So, in other words, when the camera is attached to a character jitter will always result if semi soft cam (or some more complex workaround) isn't used?

Also, does this have any impact on using mouse x-y movement instead of keys? For what I want to do, I need to have that mouse control. Thanks.
20 November 2015 07:51
Hi ben!

I took a somewhat different approach, but I also have the jittering issue. Learning this on the fly, as I've been doing, has been challenging at times. I expect one of the dev team will show up and let us know what that's about. Thanks for the file sample.
19 November 2015 23:51
I've got something I'd like to try that I haven't been able to find in a tutorial or on the forum. I would like to set up controls that work - for example - like the "Minecraft" interface: ASDW controls movement, and the mouse controls the view and direction. How do I do this?