Getting a script object to point at the player?
Moderator: Moderators
I had a couple of more ideas . Make a turret add a origin brush at it's center and make them a script object .Make the barrel a separate script object with a origin brush at it's base and bind it to the turret . I think that ( 0 0 0 ) in the editor is it's starting vector (level faceing the right side of the editor) so if you do a vector_toangles from the gun to the player you can rotate to those angles? is that right or is it turret.origin-player.origin I get a little confused with vectors I usually do it by trial and error . Any way you need to let the gun know what way is forward it only sees a script object only you know it's a gun . If it is a one piece gun put the origin brush at the pivot point .
Map
Why not download my test map and try it yourself? It compiles in less than a minute, even on V, V, Final. I use trial and error too--mostly error. My test gun has an origin brush at the center of the vertical cylinder, but the gun still rotates on all three axis.
http://pages.sbcglobal.net/tltrude/Temp/auto_gun.zip
I have no clue as to how to make it rotate on only one axis. When I use anything but "rotateto" the guns stops moving.
http://pages.sbcglobal.net/tltrude/Temp/auto_gun.zip
I have no clue as to how to make it rotate on only one axis. When I use anything but "rotateto" the guns stops moving.
Need help
I got the gun to rotate on the vertical axis, but I'm having trouble with the barrel. It points at the players feet and FLIPS 360 every second. The main part of the gun works ok except when you cross the 360/0 degree line to the north. Rather than move streight from 359 to 1 it spins all the way around--to avoid 360/0 I guess.
My test map has been updated:
http://pages.sbcglobal.net/tltrude/Temp/auto_gun.zip
HELP!!!!!!!!!!!!!!!!!!!
My test map has been updated:
http://pages.sbcglobal.net/tltrude/Temp/auto_gun.zip
HELP!!!!!!!!!!!!!!!!!!!
Ok I had a look at it and I think I have your answer for you have a look and see if it is what you wanted . I included the map so you can see what I did which was to delete the scipt origins and add a script object (the gun barrel ) that has a origin brush as part of it . The turret part of the gun rotates and the gun part points at the player .
http://members.shaw.ca/bdbodger/auto_gun2.zip
http://members.shaw.ca/bdbodger/auto_gun2.zip
oh ya I forgot to say I too has a bit of a problem with it spinning around some of the time not sure if you can fix it or not but it doesn't do it too much may be ok . The barrel works though . I didn't see your second map so if after you look at what I did and it is not what you want I can take an other look for you if it is needed .
Cool
It's not for me, but for the guy in the first post. Anyway, you did real good and I'm sure someone will use it someday.
The only thing I see wrong with your script is that you didn't make the gunbarrel a seperate (self) thread. He did name it car1-gun1, so I assumed he would be making more than one gun.
I made a stab at adding sound to the gun in my script. But, I didn't work on any player proximity triggers, and I'm not going to unless the guy comes back and asks.
You can continue to work on it, if you like--maybe make a tutorial out of it. Script_object guns that shoot at players would be a good thing for the game, I think. But, I'm done with it for now.
GOOD WORK bdbodger!!!!!!!!!!!!!!!!
The only thing I see wrong with your script is that you didn't make the gunbarrel a seperate (self) thread. He did name it car1-gun1, so I assumed he would be making more than one gun.
I made a stab at adding sound to the gun in my script. But, I didn't work on any player proximity triggers, and I'm not going to unless the guy comes back and asks.
You can continue to work on it, if you like--maybe make a tutorial out of it. Script_object guns that shoot at players would be a good thing for the game, I think. But, I'm done with it for now.
GOOD WORK bdbodger!!!!!!!!!!!!!!!!
-
Bjarne BZR
- Site Admin
- Posts: 3298
- Joined: Wed Feb 05, 2003 2:04 pm
- Location: Sweden
- Contact:
Tiny tank
I just had a thought, the guy could of used a scaled down tank turret. Then he could of used all those commands that only work with models. Probably could of bound a script_object shell around it too--maybe not the barrel part though.

