Turning an object with the X/Y mouse axis
by Kevin James · in Torque Game Builder · 07/20/2006 (3:52 pm) · 7 replies
Greetings!
Obviously you know that this thread has to do with "turning an object with the X/Y mouse axis".
THE DETAILS--->
I'm making a Tank (as in the military vehicle) game. As far as movement control I'm leaning towards "wasd", or just the keypad. . .easy enough. My problem is getting the tank's turret to rotate towards where ever the mouse cursor is, so that the tank fires where I click, and the turret is actually pointing towards the target. When all this is said and done the tank would have would have a Battlefield feel of the ability to drive one way, and fire in another direction.
Any help will be appreciated!
(btw, does Bulletin Board Code (BBC) work here?)
---Syreal
Obviously you know that this thread has to do with "turning an object with the X/Y mouse axis".
THE DETAILS--->
I'm making a Tank (as in the military vehicle) game. As far as movement control I'm leaning towards "wasd", or just the keypad. . .easy enough. My problem is getting the tank's turret to rotate towards where ever the mouse cursor is, so that the tank fires where I click, and the turret is actually pointing towards the target. When all this is said and done the tank would have would have a Battlefield feel of the ability to drive one way, and fire in another direction.
Any help will be appreciated!
(btw, does Bulletin Board Code (BBC) work here?)
---Syreal
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
#2
Edit: Project: 'scrollerDemo' in your games folder.
07/21/2006 (2:20 am)
HERE is a MiniTutorial with an attached resource that does exactly what you just described. WASD movement of a tank and the turret always tries to point towards the mouse cursor. Firing projectiles is covered in the scroller tutorial that comes with TGB.Edit: Project: 'scrollerDemo' in your games folder.
#3
07/21/2006 (10:39 am)
Many thanks to both of you. If I can't figure it out with all this help, I should just stop using TGB right now! lol
#4
07/21/2006 (1:04 pm)
Good luck! ;)
#5
These links are exactly what I needed!
What actually took probably 1 or 2 hours, would have taken me 1 or 2 days to do on my own.
Thanks again!
07/21/2006 (1:27 pm)
Wow, I was expecting to do a little bit of work. . .These links are exactly what I needed!
What actually took probably 1 or 2 hours, would have taken me 1 or 2 days to do on my own.
Thanks again!
#6
07/22/2006 (5:18 pm)
Your welcome :). Well done on getting it working. Just love the feeling of seeing it actually working instead of if sitting there statically while your move the mouse furiously! lol
#7
07/23/2006 (12:51 pm)
Indeed, Apurva. Nevermind the smoking hole in my mouse pad, it was worth it in the end! Hahaha!
Torque Owner Apurva Amin