Hi guys,
I am terrible at math, and would really appreciate some help.
I want a script to move Object A to Object B, in 3D space. 3D is important, so I need the Z factor calculated.
My inputs would be:
1. Target Object
2. Object to move
3. Speed of Object to move.
I think I have to use SetVelocity and SetVectorDir on the Object to move, but don't know how to calculate the values.
Below is my weak attempt.
Can anybody help me with this?
Thanks!
_target_object = _this select 0; // target object
_vehicle = _this select 1; // object to move to target
_speed = _this select 2; // desired speed of object to move
_targetPos = getpos(_target_object);
_speed = speed _vehicle;
// assume vehicle is facing target
_dir = getDir _veh;
// Calculate velocity x,y,z factors
_vx = (sin _dir)*_speed;
_vy = (cos _dir)*_speed;
_vy = ???? //// How do I cacluate Y value??
// I think this is how you move the vehicle toward the target
_vehicle setVectorDir[_vx/_vh, _vy/_vh, _vz/_vh];
_vehicle setVelocity [_vx, _vy, _vz];