o3d pick and move delay problem

Skip to first unread message


May 19, 2011, 11:13:02 AM5/19/11
to o3d-d...@googlegroups.com
I am new to o3d/webgl, and i implement my own javascript function to do unproject and intersection calculation for 'pick and move'.
Each time the mouse moving to a new position(x, y), i apply translation to the transform of the selected shape according to my calculation,
which results in delay, i mean, the mouse cursor moves faster than the object before mouse up. Is there any way to improve
the performance?



Nicolas Kassis

May 19, 2011, 11:38:24 AM5/19/11
to o3d-d...@googlegroups.com
HI Zuo,

I have the same problem as you, trying to translate objects around and
I can't come up with something as smooth as what I use for rotation (I
took the code from the Arc Ball example). Would you mind posting the
code you are using, we could compare.


> --
> You received this message because you are subscribed to the Google Groups
> "O3D-discuss" group.
> To post to this group, send email to o3d-d...@googlegroups.com.
> To unsubscribe from this group, send email to
> o3d-discuss...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/o3d-discuss?hl=en.

Nicolas Kassis


May 19, 2011, 12:37:49 PM5/19/11
to o3d-d...@googlegroups.com
Hi, Nicolas

My code structure is almost like this:
It is to move a object on a specified plane.

var objPos; // position of the object to be selected
var objTransform;

function mouseMove(e) {
                       // two points make a line
var pos1 = unproject(e.x, e.y, 0.25);
var pos2 = unproject(e.x, e.y, 0.75);
                       // find intersection with the specified plane
var pos = mousePoleGo(pos1, pos2, objPos);
                        // do translation and update object position
                        objPos = pos;

The unproject and mousePoleGo functions are both translated into javascript from some utility library in openGL.


Jun 1, 2011, 2:09:27 AM6/1/11
to O3D-discuss
Hi Zuo,

I hope I did interpret your question correctly.

I assume the slow down was caused by multiple picking. The default
picking function in O3D is not the fastest picking that was

Since you are only moving along with a plane, how about you just do
picking only once.

Use picking to grab the tangent value of the point. Later, you can
manipulate the translate using that tangent value.

I haven't really tested this method, so I might be wrong.

Reply all
Reply to author
0 new messages