|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4228
06/04/01 04:28
06/04/01 04:28
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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?
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4229
06/04/01 06:23
06/04/01 06:23
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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?
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4230
06/04/01 07:29
06/04/01 07:29
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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.
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4231
06/04/01 23:51
06/04/01 23:51
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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).]
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4232
06/05/01 00:20
06/05/01 00:20
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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.
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4233
06/05/01 00:22
06/05/01 00:22
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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).]
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4234
06/09/01 20:01
06/09/01 20:01
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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?
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4235
06/09/01 22:47
06/09/01 22:47
|
Joined: Jul 2000
Posts: 2,037 Lafayette, LA USA
James Snydstrup
Senior Expert
|
Senior Expert
Joined: Jul 2000
Posts: 2,037
Lafayette, LA USA
|
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.
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4236
06/09/01 23:35
06/09/01 23:35
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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.
|
|
|
Re: CENTERING PROJECTILES (MAYBE ONE FOR DOUG)
#4237
06/10/01 14:32
06/10/01 14:32
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
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.
|
|
|
|