GetChangedPosition(vector, float, float)
Convenience function that returns a vector that is fDistance away in fAngle direction
Original Position as a Vector
Distance to new location
Direction to new location
This is a convenience function that returns a vector representing the position that is (fDistance:float*meters) at fAngle:float from vOriginal:vector. The function does not calculate any change in the Z-axis, instead assigning the current Z-axis to the new position. If a negative coordinate is generated, the absolute value will be used instead.
float GetChangeInX(float fDistance, float fAngle)
float GetChangeInY(float fDistance, float fAngle)
This writer has to wonder why the author of this function didnât simply write it as follows:
vChanged.z = vOriginal.z;
vChanged.x = vOriginal.x + (fDistance* Cos(fAngle));
if (vChanged.x < 0.0)
vChanged.x = - vChanged.x;
vChanged.y = vOriginal.y + (fDistance* Sin(fAngle));
if (vChanged.y < 0.0)
vChanged.y = - vChanged.y;
This would have avoided the cognitive overhead of two extra functions (GetChangeInX, and GetChangeInY). Although I can see the need for a AbsFloat(fNum:Float):float that returns the absolute value of a float (since the Abs function takes an int)...
#include " x0_i0_position "
author: Michael Nork