View Full Version : Vector questions

17th Nov 2001, 08:57 AM
Is there a vector that stores the direction a player is looking to? If not is there an other way to get it in a vector.

Second question how do I get the vector from one actor to another?


17th Nov 2001, 09:57 AM
The direction a player is looking is stored in his "ViewRotation". This is a rotator, so you'll need to convert it to vector like this: "Vector(Player.Viewrotation)" (Or whatever way you're accessing the player). If you're making a weapon, I suggest you use "AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget)" to get the direction, since this takes AutoAim and bot's inaccuracy into account.
Getting a vector from one actor to another requires you to know what actor you want to have the vector. Let's say you just created a projectile and stored a pointer to it in a variable named "Newprojectile". What you do then is "Newprojectile.Velocity=vector(Playerpawn.Viewrotation)*1000" or something.
Everywhere I used quotes, you shouldn't. ;)
I hope this clears things up.

17th Nov 2001, 10:49 AM
I don't want to make weapons :rolleyes: I want to use it for something completely different, I can't say what tough

20th Nov 2001, 06:55 PM
Then use the ViewRotation method.
There's also the GetAxes function:

X,Y and Z is "out" variables, which means, the function alters those.
Used if you have to return more than one value...

20th Nov 2001, 09:24 PM
vector v=actorB.location-actorA.location
this gives you a vector.