Making a pawn go where you want it
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Making a pawn go where you want it
I want to have a pawn that goes to a spot where my crosshair is. Basically, I look at a point in the ground and the pawns will go to the spot. It's pretty hard though, any ideas how to do this?
Herp derp.
Re: Making a pawn go where you want it
You could measure the distance between the camera and the spot where the crosshair is pointing with GetCollideDistance() and with a bit of trigonometry you should be able to calculate the X, Y and Z coordinates of that point.
Another option that crossed my mind is to launch a pawn from the camera's position to the crosshair's direction and mark the spot where it collides with the ground.
Another option that crossed my mind is to launch a pawn from the camera's position to the crosshair's direction and mark the spot where it collides with the ground.
Pain is only psychological.
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: Making a pawn go where you want it
I was considering trig by getting the pitch of the camera then using tan, but I wanted to try the projectile idea first. how would you find the point where the pawn hits the ground?
Herp derp.
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: Making a pawn go where you want it
Yep, all the pitches and yaws are in radians.
Use a pawn with a small bounding box and fly to the camera's direction with flymove(). When flymove() returns false the pawn has collided with something and that's your point (the pawn's X, Y and Z coordinates).how would you find the point where the pawn hits the ground?
Pain is only psychological.