Isometric movement by continuous mouse-down input
by Cassy Brink · in Torque 3D Professional · 07/29/2010 (2:44 am) · 7 replies
I'm working up a small Action/RPG prototype, and I was following the RTS Prototype tutorial for using the mouse for input, and I'm wondering what the best means for continuous movement direction adjustment based on the position of the mouse while the mouse button is held would be. I've tried setting up a schedule, but I've had no luck (due to the fact that I don't know how to capture the proper ray based on the mouse and camera positions.
Suggestions? >.>
Suggestions? >.>
About the author
I'm a transgendered game programming student at the University of Advancing Technology, a fan of Japanese language and culture, and an OpenGL enthusiast.
#2
07/29/2010 (3:49 am)
It has *continuous* movement by mouse? I don't want to pick it up only to find that it only has click-to-move. :P
#3
07/29/2010 (5:53 am)
Well it is basically T3D in ISO form single player with inventory system and some other things. Just check it out and decide if the learning is worth the cash.
#4
1.a) add the lines at the end of GameTSCtrl::onMouseMove:
3) in your onMouseMove callback (add a new one in playGui.cs just like the onMouseDown function - same arguments), if that variable is 1, do a raycast to the terrain and set the new move destination to that point
07/29/2010 (6:55 pm)
1) Add an onMouseMove callback to the gameTSCtrl in source code1.a) add the lines at the end of GameTSCtrl::onMouseMove:
if( isMethod( "onMouseMove" ) ) makeScriptCall( "onMouseMove", evt );2) Set a variable to 1 on onMouseDown and 0 on onMouseUp in your playGui.cs script file as per the RTS sample
3) in your onMouseMove callback (add a new one in playGui.cs just like the onMouseDown function - same arguments), if that variable is 1, do a raycast to the terrain and set the new move destination to that point
#5
Thanks for the help.
07/30/2010 (4:36 pm)
Bryan: Apparently, onMouseMove isn't called when the mouse is dragged. Going off of this suggestion, though, I found out that there is an onMouseDragged - added that to GameTSCtrl, copied the contents from onMouseMove (except I changed the event that was called), and it works perfectly, now. And I don't need a flag variable to get it working. :DThanks for the help.
#6
You know, for the Binary users that lack the awesomeness of source access. >.>
07/30/2010 (4:47 pm)
On another note, I think that GameTSCtrl should be updated in the stock T3D build to call the script function in onMouseMove and onMouseDragged. You know, for the Binary users that lack the awesomeness of source access. >.>
#7
07/30/2010 (5:18 pm)
That is a good suggestion. There are still many areas, such as this one, in which the binary experience could be greatly improved or made more useful.
Torque Owner JesseL
Pyrotronics-Games