Game Development Community

Drag an object

by Yanling Wu · in Technical Issues · 04/27/2005 (8:48 pm) · 7 replies

Anyone tell me how to implement draging an object with mouse pressed and the object will be stopped when the mouse is loosed? Thanks a lot.

#1
04/28/2005 (7:38 am)
This probably isn't much help, but since the in game editor does exactly that, I would start looking there.
#2
04/28/2005 (3:45 pm)
Yes just set the drag? or some other settings on the units and use the technique todd just mentioned.
#3
04/28/2005 (4:15 pm)
Actually, IIRC when you drag what you are doing is shooting a vector under your mouse from your selected object to your target position and then doing a setTransform on the selected object.
#4
04/28/2005 (6:21 pm)
Actually what i want is the objest can follow after the mouse. Generally when we select an object, we use cross cursor which is always at center. But i want select and drag the object wherever it is instead of having to adjust its position to the center of the screen. I surpose it will look more closed to reality as we pick up something in real world.
#5
04/28/2005 (7:07 pm)
Exactly what we just said, just turn mouse on(no crosshair) and copy from editor(drag feature). To test this just F11 or what ever it is and try selecting and dragging. You can then set the drag and follow delay.
#6
04/28/2005 (9:00 pm)
How can the user use the mouse to select and drag during the game?
#7
05/09/2005 (2:06 am)
Is there anyone can help me? Is it very difficult to realize the function as the world edit has done? :-(