Weird Mouse behaviour
by Aditya Kulkarni · in Torque Game Builder · 11/13/2009 (12:54 am) · 5 replies
I am using onMouseDown, onMouseDraggable and onMouseUp to make an object draggable. When I move the pointer fast on the screen, it kinda loses the object midway (i.e. object is not dragged along).
It works great when I move the pointer slowly.
Would increasing the sensitivity help? How would I go about doing that?
It works great when I move the pointer slowly.
Would increasing the sensitivity help? How would I go about doing that?
#2
11/13/2009 (1:47 am)
it does that even if the mouse pointer is well within the camera view...it doesn't even have to go outside that boundary...
#3
That code needs a lot of filling out to be robust, but it's the general idea. (I know there is a good example of drag-and-drop out there, but I can't seem to find it.)
The key difference is that the window handles the dragging behavior, not the object.
11/13/2009 (2:57 am)
I know exactly what you mean. What I'm trying to say, without writing all of the code for you, is this:$heldObject = 0;
function SpriteObject::onMouseDown( %this, %modifier, %worldPos )
{
$heldObject = %this;
}
function sceneWindow2D::onMouseDragged( %this, %modifier, %worldPos )
{
if( $heldObject == 0 ) return;
$heldObject.moveTo( %worldPos );
}
function sceneWindow2D::onMouseUp( %this, %modifier, %worldPos )
{
if( $heldObject == 0 ) return;
$heldObject.moveTo( %worldPos );
$heldObject = 0;
}That code needs a lot of filling out to be robust, but it's the general idea. (I know there is a good example of drag-and-drop out there, but I can't seem to find it.)
The key difference is that the window handles the dragging behavior, not the object.
#4
11/16/2009 (11:41 am)
this works...thanks a lot!
#5
11/16/2009 (3:23 pm)
Cool! Good to hear!
Associate William Lee Sims
Machine Code Games