Game Development Community

Movement on MouseRightDragged

by Playware · in Torque Game Builder · 12/22/2006 (2:30 am) · 2 replies

Hi,


Here I need to do movement with right MouseDragged function. I am using

function sceneWindow2D::onRightMouseDragged( %this, %mod, %worldPos, %mouseClicks )
{
myObject.moveTo(%worldPos, 30);
}

No main Problem heppens here. For a few seconds, it runs quite good. But slowly-2 Game speed goes to very slow and jerky and after some times hanged.

What could the problem ?

How I will get smooth movement with onRightMouseDragged.


any help is appreciated.

thnx.

#1
12/22/2006 (9:00 am)
You are calling the moveTo function over and over for every onRightMouseDragged event... which is quite a few times per second.
#2
12/24/2006 (1:37 am)
I would rethink your logic. With that function and that function alone, your object will only move when the right mouse is dragged. Not when it's clicked, and held still. Also it wouldnt matter if you clicked on the object or just a random spot on the screen. Pretty much what you're saying is:

No matter where the object is or where I clicked, attempt to MoveTo() the *dragged* location.

I don't see a use for this; but maybe I'm blind to your game/project idea.

If you post here a more detailed description of how you want things to happen, I'll write up the script to get you started, if you'd like.