Forum

User posts Marcos Calvi
28 September 2016 13:21
Ok, I take a note
28 September 2016 11:28
Ah, ok, I'll try it, thank you
26 September 2016 22:27
Well, I think I got it at last, this is the file: parsec_project.zip
26 September 2016 22:16
Sorry, I had a problem with the file. Trying to fix it….
26 September 2016 20:26
Sorry, the first file don't have the click method activated. This is the good one….
26 September 2016 20:19
You have the file in this post
The blue cube is the object that is selectable, I think the ship cockpit should be selectable too.
Thank you
26 September 2016 20:18
Hi, Ivan, thank you for your attention.
The project is a bit complex because I'm trying to put the camera inside a space ship, and control it from the keyboard. I attach the file if you want to take a look. It is a little messed up because I'm making changes to fix it. It is a FPS, controls are wsad and enter to enter the ship. Inside the ship I'm trying to make it rotate with a and d keys. If you start up the engine with Mays+I you can accelerate with Mays+Q and decelerate with Mays+E and apply power left and right with Q and E. Maybe I'm going a bit too far to my knowledge, hehe… I think in the engine there is some problem with the key sensors, you have to press the key twice to make it work…
23 September 2016 01:15
I'm trying to rotate and object by pushing a key in the keyboard and it rotates (in an ugly form really as it doesn't interpolate the rotation) but my problem is when I release the key the object gets back to the original position.
The code is:
m_trans.get_rotation(obj, _vec4_tmp);
m_util.quat_to_euler(_vec4_tmp, _vec3_tmp);
_vec3_tmp[1] += 0.1;
m_util.euler_to_quat(_vec3_tmp, _vec4_tmp);
m_trans.set_rotation_v(obj, _vec4_tmp);

Can anyone help me with that?
21 September 2016 19:21
Hi,
I'm trying to get an object by clicking on it, the function is:
function setup_click_on_object() {
	_canvas_elem.addEventListener("mousedown", function(e){click_on_object(e)}, false);
	
	function click_on_object(e) {
		console.log("Clicked");
		// if (_disable_interaction)
        // return;

		if (e.preventDefault)
			e.preventDefault();
		
		var canvas_xy = m_cont.client_to_canvas_coords(e.clientX, e.clientY, _vec2_tmp);
		
		var x = canvas_xy[0];
		var y = canvas_xy[1];		
		
		var obj = m_scs.pick_object(x, y);
		
		if (obj)
			console.log(m_scs.get_object_name(obj));
		}
}

And the console returns:
TypeError: Argument 2 is not valid for any of the 2-argument overloads of WebGLRenderingContext.uniform3fv.

Have you experimented something like that?
In the debug I found out the error is in the renderer module, renderer.js:1502:17, and it has something to do with UI_color_id, this is the renderer.js bit:
        case "u_color_id":
            fun = function(gl, loc, obj_render, batch) {
                gl.uniform3fv(loc, obj_render.color_id);
            }

Any help is welcome
02 September 2016 19:15
Ah, I have made other thing, made a new project and copy the exports to the old one. Changing all the imports works ok.

So, it is just the subscene module, I had the modules checked in the project manager and it logs a lot of changes. Well, everything works ok now. Now, I'm gonna take a look at the new improvements, thank you for the great work again.

Cheers