user1658740
user1658740

Reputation: 75

In Three.js Picking Ray, How Objects moves only X,Z? not Y

now Objects move every direction. but I want to Objects move only X or Z, not Y.

I try this. but result is not good.

on MouseMove

// OBJECT SELECTED
if ( SELECTED ) 
{       
    var intersects = ray.intersectObject( PICKING_PLANE );SELECTED.position.set( intersects[ 0 ].point.x, 0, intersects[ 0 ].point.y ); /*SELECTED.position.copy( intersects[ 0 ].point.subSelf( offset ) );*/
    return;
}

How can I solve this problem?

Upvotes: 0

Views: 463

Answers (1)

mrdoob
mrdoob

Reputation: 19592

Store the Y position the object had when you started dragging it. Then apply that Y position at dragging time.

Upvotes: 1

Related Questions