Sorry to say it Jess, but my coding skills are as bad as a bone... or whatever
Anyway, I used the link that was posted before to substract this piece of code. I think some of the lines are not needed, but I left them in the code, because it now simply works... And you can change the height to start and stop the line. Here it is (and all credits go to Jestermon):
Anyway, I used the link that was posted before to substract this piece of code. I think some of the lines are not needed, but I left them in the code, because it now simply works... And you can change the height to start and stop the line. Here it is (and all credits go to Jestermon):
Code: [Select]
int TARGET = OBJ_0;
int CAR = OBJ_22;
int LINE = OBJ_44;
void Main()
{
Vector3 location;
Quaternion orientation;
Vector3 targetLocation;
Vector3 direction;
//set the arrow
iObjectLocation(TARGET,targetLocation); //get target locatiob
iObjectLocation(CAR, location); //get catr location
location.y += 0; //set location 2m higher
direction = targetLocation - location; //get direction of targer
iQuaternionLookAt(orientation,direction,Vector3(0,1,0)); //make rotation quat
//set the line
float length = iVectorLength(direction); //get the length of direction
location.y -=0; //make direction y 1m lower
targetLocation.y +=0; //make target y 1m higher
direction = targetLocation - location; //get new direction
iQuaternionLookAt(orientation,direction,Vector3(0,1,0)); //make quat from direction
iObjectLocationSet(LINE,location); //set line at 1m above car
iObjectOrientationSet(LINE,orientation); //rotate line to target
iObjectScaleSet(LINE,Vector3(6,6,length)); //scale line = distance to target
}