I want to retrieve the X,Y,Z components of a vector. Is there a function that does this?
is there a function that gets the individual component values of a vector?
Débuté par
M. Rieder
, avril 03 2011 11:54
#1
Posté 03 avril 2011 - 11:54
#2
Posté 04 avril 2011 - 12:07
GetPosition() will give you the vector.
#3
Posté 04 avril 2011 - 12:11
You don't have to, it's part of the vector
if you have
vector vLocation = LocationToVector( GetLocation(OBJECT_SELF));
float fVarx = vLocation.x;
float fVary = vLocation.y;
float fVarz = vLocation.z;
You can also just use the vector itself, as above and treat it like a float.
More examples are in this, which can be pretty much used as is
Common Script Library - Position
if you have
vector vLocation = LocationToVector( GetLocation(OBJECT_SELF));
float fVarx = vLocation.x;
float fVary = vLocation.y;
float fVarz = vLocation.z;
You can also just use the vector itself, as above and treat it like a float.
More examples are in this, which can be pretty much used as is
Common Script Library - Position
#4
Posté 04 avril 2011 - 12:12
Thanks for the response Shaughn. I wasn't completely clear about what I am trying to do. I just wanted to get the Z value from the vector so I could change it, but I figured out a way around my problem. I want to change the height of an object during runtime. I figured out how to do it. I got the vector then added another vector to it. The vector I added only had the z value. It worked great.





Retour en haut






