veldif=VectorSub(GetThingVel(projectile), GetThingVel(target)); speed=VectorLen(veldif); distance=VectorDist(GetThingPos(target), GetThingPos(projectile)); time=distance / speed; moved=VectorScale(GetThingVel(target), time); meetpos=VectorAdd(GetThingPos(target), moved);Now you have the position (meetpos) that the projectile needs to aim at. The code below will make the projectile look and travel in the new direction:
lvec=VectorNorm(VectorSub(meetpos, GetThingPos(projectile))); SetThingLook(projectile, lvec); projspeed=VectorLen(GetThingVel(projectile)); SetThingVel(projectile, VectorScale(lvec, projspeed));Note that you have to provide a projectile and target for this code. And be sure to define all of the variables in the symbols section.
Code provided by *_Seifer_*.