|
I am looking to create an airstrike as a third weapon of my game. I can get it to fire a rocket and it fires in the direction that im facing but the issue that im running into is having it hit where my cross hairs are facing. It would also be a possibility of creating new cross hairs while in the airstrike mode that are on the ground in front of you. Here is my current code. Any thoughts?
(comments are locked)
|
|
By the looks of it, just change:
to It didnt work. I think its because there is not mousePosition. I trying to add this to the FPS tutorial for testing purposes. So you have your center crosshairs and no mouse. The airstrike spawns way above the character. It shoots in the direction of the cross hairs just not in the center of the screen that I am looking at. I think I have to switch this to some form of RayCast just not certain on how that works fully.
Jul 29 '10 at 08:04 PM
behnker
It may be better to explain how you're doing the crosshairs then, I assumed it was where the mouse was.
Jul 29 '10 at 08:28 PM
Mike 3
Thanks for the help Mike. It sent me in the right direction of figuring out the answer.
Aug 03 '10 at 07:16 PM
behnker
(comments are locked)
|
|
Ok I figured it out. Below is the code that works for me. If anyone is going to set this up in their game I would say go a step further and add a cross hair that runs accross the ground and put the game object with this script attached to the ground cross hair that way when ever you do the air strike it shoots down onto the object. Anyway to change this so the projectile doesn't hit instantly?
Aug 03 '10 at 09:16 PM
Fishman92
@Fishman92 -maybe adjust the initialspeed variable
Mar 27 '11 at 08:21 PM
Ullukai
(comments are locked)
|

Format your code by selecting it and hitting the Code Format button.
Thanks. This is my first post and I couldnt figure that out.