Dragging Object in game
by Nancy Lee · in Technical Issues · 12/11/2008 (11:42 pm) · 1 replies
Hi, for my game, I would like to add dynamic object dragging with the in game mouse. so it should work in the following manner:
- get the cursor (already done)
- select object
- drag the object elsewhere
I have followed Ehab Yosry Amer's tutorial Mouse, Camera & Selection Combined Resource at the following URL address:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13617
Now I can select object but I am still now sure how to do the dragging part.
Is there any tutorial teaching ppl how to drag objects?
Is there a way to drag object like how it is done in the GUI editor?
If I want to fine the current camera position (third person view), which function should I use?
Thanks very much for helping.
- get the cursor (already done)
- select object
- drag the object elsewhere
I have followed Ehab Yosry Amer's tutorial Mouse, Camera & Selection Combined Resource at the following URL address:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13617
Now I can select object but I am still now sure how to do the dragging part.
Is there any tutorial teaching ppl how to drag objects?
Is there a way to drag object like how it is done in the GUI editor?
If I want to fine the current camera position (third person view), which function should I use?
Thanks very much for helping.
About the author
Vyacheslav Klymenko
%objectsArr = t2dSceneGraph.pickPoint(%worldPosition);
%worldPosition - mouse's position ("x y");
%objectsArr - local variable, that contains picked by mouse objects-array.
In this way you will find picked object - please remember his id
at global variable and put some swith-variable on, because while mouse button in down-state - we don't need to pick every millisec.
This to do with "sceneWindow2D::OnMouseDown".
Then on "sceneWindow2D::OnMouseDrag" position the object with mouse's position.
P.S.: It is hard to explain in few words - please, contact me if you want some example code ;)