CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
Posted By: Anonymous
CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/04/01 04:28
OK, I have been trying so hard to get this to work, and I have tried loads of peoples scripts. Can anybody give me some code which will make moving projectiles (not bullets) move towards the center of the screen. Please, can somebody help?
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/04/01 06:23
Ok, Ihave decided to make my own cenering code if nobody has one to give. However, does anybody know what the vector is that tells the projectile what its final destination is?
Also, does anybody know how to make an imaginary(invisible) line between two points and record the distance of the line?
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/04/01 07:29
About your second question, from page 49 of the manual:
The vec_dist() instruction returns the distance between two positions.
"Center of screen" is relative in the 3D world. It maybe close to the view, or at a distant object. You could use camera vector and, if it is the distant object that you want, use trace. I guess.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/04/01 23:51
Joke99,
By "Center of Screen" do you mean Player's "line-of-site" ?
-Neut.
[This message has been edited by NeutronBlue (edited 04 June 2001).]
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/05/01 00:20
Yes I do. So there will be a crosshair in the center of the (2d) screen and the projectile will go from the gun_muzzle, towards the center of the players line of sight.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/05/01 00:22
Look in the "weapons.wdl" and and search for the rocket launcher code.
It orients the rocket model to the player's line-of-site and whisks it away towards it's target...boom!.
Edit: There are 2 to 3 parts of this code spread over the whole file.
Look for them all to get the "complete" picture, so to speak..
-Neut.
[This message has been edited by NeutronBlue (edited 04 June 2001).]
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/09/01 20:01
Ok, so, here is what I need, just to make it clear:
1) How do you shoot an imaginary line from the center of the screen going forwards until it hits a wall, then record the vector where it hits?
2) Where is the vector stored where the projectile is going towards? Is there one?
My plan is, to get the vector which is straight infront of the player on the closest wall, and then put that vector into the one which tells the gun where to shoot the projectile. Can anybody give me any help on this?
Posted By: James Snydstrup
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/09/01 22:47
Jokester999:
That's not a bad idea. I have run across this same sort of problem. If you use a crosshair for aiming you want your projectile to always go where the cross hair is. My solution was to 'center' my weapons instead of left side or right side of the screen. Then I just shot the projectile from the camera straight out. However, I like your idea because then you could use 'left', 'right' weapons with a crosshair.
You will have to use 'TRACE' to accomplish this. I believe 'TARGET' will return the vector where the 'ray' hits. Just read through the 'TRACE' command in the manual and start experimenting.
Some hints:
1. Put your crosshair dead center of the screen.
2. Trace your ray from the CAMERA's position, not the PLAYER's.
3. The orgin of the ray is easy, the camera position, the destination is a little harder, you will need to use a little trigonometry.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/09/01 23:35
Hi James, that must be the first time anybody has liked one of my ideas. As you said, you will have to use trigonometry to work some bits out. This shouldn't be a problem, I am quite good at it, and it is only simple stuff. I will start playing around with trace like you said, and report back in a few days and tell you what I came up with.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/10/01 14:32
This is an easy one:
using set_pos_ahead with p=10, shoot to p=999999999. Then put the RESULT into a SKILL, finally, shoot from gun_muzzle, to that skill.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/11/01 07:06
Skater, I don't quite understand your post. Can you re-write it please. Do you mean set p=10, then call set_pos_ahead, then the shoot bit I didn't understand. Can you tell me again please. Thanks for helping.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/11/01 00:44
IF you want the gun to fire projectiles from the muzzle, directly into the center of the screen, right something like this:
code:
p = 999999999;
set_pos_ahead();
vec_set(gun_target,MY_POS);
Put this where you would normally find the gun_target code in the weapons.wdl.
This should always center the bullet.
Rockets are a little more complicated, but I can do it if you want me to.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/11/01 00:56
Skater, interesting results! The projectiles turn round and hit me in the face! Is this what your code is supposed to do? I meant, I want it so that the projectiles come from the gun muzzle, and go towards the center of the screen, but going forwards! Have you ever played a shoot em up!
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/11/01 07:12
Note that I said something like this, not this is exact. Look at the Weapon_carry function for a better idea. I've player more shootem up games then most people will in there entire life, I have well over 50 boxes in my corner from games that are all First Person Shooters.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/11/01 09:47
Please explain a little better what you want. Do you want the bullets to line up in the center of the screen, or something like the Rocket Launchers centering (even though they were fired from the gun_muzzle?
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/12/01 00:26
All I want is a centering code like any shoot em up. Where you have a crosshair in the center, (which I can do!), and all bullets and rockets fly towards where the crosshair is pointing to. If you have played loads of shoot em ups, you should know what I mean. I have got it working, so that the rockets go towards where the crosshair is pointing, but they don't leave from the gun muzzle. They leave from the center of the screen.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/12/01 00:39
I have a way of doing it, but the only way I could make the rocket appear to leave through the rocket launcher was by putting it in the rocket launcher, The Rocket Launcher clips off, so the gun_muzzle won't fire. First off what did you do to make the rockets fly toward the middle? DId you do a shoot?
[This message has been edited by Skater (edited 11 June 2001).]
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/12/01 00:42
No, I used part of your code, the one you are giving away.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/13/01 03:12
I found a way of doing it, and my weapon workshop is halfway complete. I am reprogramming it entirely. Just wait a few more days and I'll send it to Jcl.
Posted By: Anonymous
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG) - 06/13/01 03:38
Wow! Nice one Skater! Thanks! Are you going to put it up for download too? JCL may take a while in putting it on downloads. I don't know.