Shoot Laser beam aiming at the crosshair
by David Alaves · in Torque Game Engine · 07/20/2007 (3:18 am) · 5 replies
Hi all,
First of all, please excuse my bad english.
I want to make a game where the player have a first person view from inside a spaceship, but I don't want the spaceship to move, I just want to move the cursor to move the crosshair freely on the screen and when I click the mouse left button the ship shoots a laser beam to the position of the crosshair.
I couldn't find something like that in the forums.
Is there any resource to do this?
In case not, how can I accomplish that? Any suggestions or ideas are welcome.
Thanks in advance
First of all, please excuse my bad english.
I want to make a game where the player have a first person view from inside a spaceship, but I don't want the spaceship to move, I just want to move the cursor to move the crosshair freely on the screen and when I click the mouse left button the ship shoots a laser beam to the position of the crosshair.
I couldn't find something like that in the forums.
Is there any resource to do this?
In case not, how can I accomplish that? Any suggestions or ideas are welcome.
Thanks in advance
About the author
#2
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3917
07/20/2007 (6:27 am)
Searching laser at the top search.garagegames.com/search?q=laser&ie=&site=GarageGames&output=xml_no_dtd&cli... gave me this resource:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3917
#3
07/20/2007 (6:29 am)
Not to mention the code involved to make the crosshair move and hte laser fire at the crosshair's position, which is what he asked for.
#4
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335
I know what you're doing isn't object selection, but it shows you how to handle raycast stuff. When I got to that point, what I had planned to do was take the concepts from that and tweak it to work with a movable crosshair object rather than with the mouse (using simple movemap stuff to bind the mouse click rather than onMouseDown), and tweaking the raycast stuff so that on activation, instead of raycasting to find an object to select, it raycasts to find a point to shoot at.
I'm sorry if that was a poor explanation, but I just woke up and like I said, I haven't quite done it yet myself. That was my plan, though.
07/20/2007 (7:19 am)
I'm actually working on something semi-similar for my game. The best advice I can give you right now is to take a look at this resource:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335
I know what you're doing isn't object selection, but it shows you how to handle raycast stuff. When I got to that point, what I had planned to do was take the concepts from that and tweak it to work with a movable crosshair object rather than with the mouse (using simple movemap stuff to bind the mouse click rather than onMouseDown), and tweaking the raycast stuff so that on activation, instead of raycasting to find an object to select, it raycasts to find a point to shoot at.
I'm sorry if that was a poor explanation, but I just woke up and like I said, I haven't quite done it yet myself. That was my plan, though.
Torque Owner Fucifer